|
Wow. So you don't know what a "pre" processor is in the context of a compiler?
led mike
|
|
|
|
|
Yes Mike I do know and am not expecting the example code I posted to work. I need something functionally equivalent to what it would do if it did work, i.e. if the PRE-processor was C++ aware. If you're telling me there's no way to control conditional compilation using compile time constants then just come out and say so.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Matthew Faithfull wrote: Yes Mike I do know
What, then why have you asked this question? I mean if you know then you know so why ask the question? Wait, now I remember trying to have a logical discussion with you in the SoapBox, never mind.
led mike
|
|
|
|
|
Yes, you didn't understand the use of a metaphor then and you clearly still don't.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Metaphor this you f***ing idiot
led mike
|
|
|
|
|
I see no alternatives to using define in your classes.
BTW why cannot you use USE_MYSOMETHING to distinguish between suffixes?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
You may be right I was hoping someone would have a brainwave.
The reason I wouldn't use USE_MYSOMETHING is because it isn't really that simple, that would be the equivalent of one case in a page long block of #if #elif #endif code, not something I'd want to repeat in more than one place. I'm left with using that lump of code to #define yet another symbol e.g. USE_SUFFIXES and then using that. It's what everyone else does but I was hoping to improve on the state of the art
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Matthew Faithfull wrote: It's what everyone else does but I was hoping to improve on the state of the art
You should stick with learning the current state of the art before you decide to try and improve it.
led mike
|
|
|
|
|
Where were you I wonder when I successfully ported Jaakko Järvi's tuple class to MSVC6, 9 months before the Boost developers managed it?
If you don't have anything useful to contribute you should stick to the Soapbox or better yet not post.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Yeah try to prove you know what you are doing by citing some project you did, good one. To late, the cat's out of the bag now.
Matthew Faithfull wrote: you should
What? I should what, take your advice? When hell freezes over dude, when pigs fly, when bears sh*t in the woods, when, wait, well you get the idea.
led mike
|
|
|
|
|
The preprocessor doesn't work like that. It just sees text and has no knowledge of the value of E_IsCool. You'll need to do something like (just the snippets here):
#define E_IS_COOL_VALUE 1
enum { E_IsCool = E_IS_COOL_VALUE };
#if E_IS_COOL_VALUE != 0
|
|
|
|
|
Yes, I realize the preprocessor isn't going to cut it. I wondered if there was any other mechanism to get the compiler to conditionally ignore/notice chunks of code with a similar effect to the preprocessor but during actual compilation. For the moment I've worked round it but in the longer run that's going to mean defining things in multiple places which is not exactly splendid. Anyway you can see how it works out as this is part of what will almost certainly be my next article, the Compiler abstraction library I ranted at Marc Clifton about nearly a year ago, expect it any time in the next 12 months
Thanks.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hello everyone,
On Windows platform, which API could be used to check whether a file is opened (either by other thread or process or even the same thread) or not?
C++ is fine.
thanks in advance,
George
|
|
|
|
|
One such way is with a device driver (like the one created for use with FileMon and Handle).
You can also check out NetFileEnum() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi DavidCrow,
After reading the MSDN document for NetFileEnum, I am confused. The description is,
--------------------
The NetFileEnum function returns information about some or all open files on a server, depending on the parameters specified.
--------------------
Server means? I just want to find all the used (open) files on the local machine. Any ideas or comments?
regards,
George
|
|
|
|
|
George_George wrote: Server means? I just want to find all the used (open) files on the local machine. Any ideas or comments?
servername
[in] Pointer to a Unicode (Windows NT/2000/XP) or ANSI (Windows 95/98/Me) string specifying the name of the remote server on which the function is to execute. The string must begin with \\. If this parameter is NULL, the local computer is used.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
But does it relates to my original question? I just want to find whether a local file is opened or not. Any comments?
regards,
George
|
|
|
|
|
George_George wrote: But does it relates to my original question?
Only you can determine if NetFileEnum() will meet your needs.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi DavidCrow,
This function will find all open files... But I only want to find whether a specific file is open or not, file name is known. The NetFileEnum function is fine, but too heavy for me.
I think using OpenFile with exclusive shared mode option is fine. Any comments?
regards,
George
|
|
|
|
|
George_George wrote: I think using OpenFile with exclusive shared mode option is fine. Any comments
That will only tell you if the file is already open with exclusive access. It will not tell you if the file is already open with shared access. AFAIK, there is no user-mode way to tell that, unless David's previous answer can do that (I haven't ever needed to use the Net set of functions).
Judy
modified on Thursday, April 3, 2008 4:19 PM
|
|
|
|
|
Thanks Judy,
I think I should use ::OpenFile() with OF_SHARE_EXCLUSIVE -- the best choice. Right?
regards,
George
|
|
|
|
|
If you want to test every file under scrutiny, yes that will work. I'd try David's enum suggestion if you're looking to get a list.
Judy
|
|
|
|
|
Thanks Judy,
I only need to test for a specific file. I think OpenFile is enough, agree?
regards,
George
|
|
|
|
|
Yes, using OF_SHARE_EXCLUSIVE
|
|
|
|
|
Thanks JudyL_FL,
Question answered.
regards,
George
|
|
|
|