News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

C header file (*.h) defined flag

Started by jdoe, April 11, 2007, 11:46:06 PM

Previous topic - Next topic

jdoe

Hi,

I'm working on a H2INC program and now I need to know what flag must be processed and include the contents in *.INC
Some are obvious like __cplusplus but some are not because I don't know a lot about C. My question is, what flag, when defined (#ifdef), should I include in *.INC and few words about them would be appreciated.

__cplusplus
MIDL_PASS
_MAC
RC_INVOKED
_PREFAST
_MSC_FULL_VER
_MSC_VER
_M_IA64
CINTERFACE
_midl

This list is not exaustive but if you know some important missing one let me know.

Thanks a lot


Tedd

There isn't really any standard, and you could run into almost any possible string of dictionary words as #defs - the sensible action would be to act naively and translate as is, still enclosing the "#ifdef" blocks with masm's own "ifdef/endif" - you'll run into problems with #undef though, as it doesn't appear to be available in masm, and equ nothing still causes it to be defined - check against being equal to 1 or 0, maybe?
Inclusion of the .inc files would then still rely on these constants being defined, and the necessary parts would be included as chosen.
It seems to be something of an informal convention (i.e. don't rely on it too strongly) but you should be able to treat lower-case symbols as 'standard' and so recognise a list of those; upper-case ones seems to be almost anything (possibly with the exception of the standard "#ifdef _FILENAME_H")

These are largely guesses..
__cplusplus      if coming from a C++ compiler (as opposed to a C one)
MIDL_PASS        MIDL = Microsoft Interface Definition Language - defined when included by the midl compiler?
_MAC             if architecture is Apple Mac ?
RC_INVOKED       defined when included by the resource compiler
_PREFAST         ??
_MSC_FULL_VER    Microsoft C full version number (defined by said compiler - to give version dependent compiling)
_MSC_VER         as above, short version
_M_IA64          if architecture is IA64
CINTERFACE       ??
_midl            ?? MIDL again
No snowflake in an avalanche feels responsible.