mjh2
asked on
#if _MSC_VER > 1000
what exactly is this statement used for
#if _MSC_VER > 1000
#pragma once
#endif
#if _MSC_VER > 1000
#pragma once
#endif
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>I might add that '#pragma once'can be used as a
>>replacement for the common practice of placing #ifdef
>>like this at the top and bottom of a header file..
You're right, but I would not recommend abandoning that practise - there are more compilers out than just VC++, even though MFC is focused a little on that compiler implementation (even though I remember that my first encounter with MFC was with Watcom 10.0)
>>replacement for the common practice of placing #ifdef
>>like this at the top and bottom of a header file..
You're right, but I would not recommend abandoning that practise - there are more compilers out than just VC++, even though MFC is focused a little on that compiler implementation (even though I remember that my first encounter with MFC was with Watcom 10.0)
???
hi mjh2,
Thanks for accepting my comment as an answer. However, in this case, all I did was add a note to an already correct and complete answer that had been given by jkr.
The 'B' grade that you awarded to me, should instead be awarded to jkr.
hi jkr,
sorry. I had no intention of 'poaching'.
-- Dan
Thanks for accepting my comment as an answer. However, in this case, all I did was add a note to an already correct and complete answer that had been given by jkr.
The 'B' grade that you awarded to me, should instead be awarded to jkr.
hi jkr,
sorry. I had no intention of 'poaching'.
-- Dan
>>I had no intention of 'poaching'
I know - you wrote 'I might add that...'. Well, let's see what mjh22 has to say...
I know - you wrote 'I might add that...'. Well, let's see what mjh22 has to say...
ASKER
I am sorry jkr.. DanRollins answer gave me more insight on what the code is used for. You gave the definition that anyone can find on Microsoft's web page.
_MSC_VER
Defines the compiler version. Defined as 1200 for Microsoft Visual C++ 6.0. Always defined.
This means - in your example - that the code enclosed will only be 'seen' by MS compilers that have an internal version stamp > 1000, as '#pragma once' is probably not implemented by earlier versions. 'once' itself means:
#pragma once
Specifies that the file, in which the pragma resides, will be included (opened) only once by the compiler in a build. A common use for this pragma is the following:
//header.h
#pragma once
// Your C or C++ code would follow: