System/ Compiler specific macros

V

vsnadagouda

Hello All,

For one of my applications I need to know what are all the predefined
system/ compiler specific macros are. All these days I used to use "-v"
or "-#" as a compiler option to figure out the required information.
But recently GCC 3.4.* compilers have stopped throwing out this piece
of information.

Is there any way I can write a piece of C program (or may be any other
way) and figure out all the system and compiler specific predefined
macros?

Thanks
-Vallabha
 
G

Grumble

For one of my applications I need to know what are all the predefined
system/ compiler specific macros are. All these days I used to use "-v"
or "-#" as a compiler option to figure out the required information.
But recently GCC 3.4.* compilers have stopped throwing out this piece
of information.

Is there any way I can write a piece of C program (or may be any other
way) and figure out all the system and compiler specific predefined
macros?

I can't imagine you'll find a portable solution.

If your compiler is gcc, then http://gcc.gnu.org/lists.html

man gcc and grep for dCHARS. Might be what you want. Or not.
 
R

Robert Gamble

Hello All,

For one of my applications I need to know what are all the predefined
system/ compiler specific macros are. All these days I used to use "-v"
or "-#" as a compiler option to figure out the required information.
But recently GCC 3.4.* compilers have stopped throwing out this piece
of information.

Is there any way I can write a piece of C program (or may be any other
way) and figure out all the system and compiler specific predefined
macros?

This cannot portably be done, why do you think you need to do this?

As far as gcc goes, from the documentation:

"Assuming you have no file foo.h, the command
touch foo.h; cpp -dM foo.h
will show all the predefined macros."

Robert Gamble
 
R

Robert Gamble

Hello All,

For one of my applications I need to know what are all the predefined
system/ compiler specific macros are. All these days I used to use "-v"
or "-#" as a compiler option to figure out the required information.
But recently GCC 3.4.* compilers have stopped throwing out this piece
of information.

Is there any way I can write a piece of C program (or may be any other
way) and figure out all the system and compiler specific predefined
macros?

This cannot portably be done, why do you think you need to do this?

As far as gcc goes, from the documentation:

"Assuming you have no file foo.h, the command
touch foo.h; cpp -dM foo.h
will show all the predefined macros."

Robert Gamble
 
C

CBFalconer

Robert said:
This cannot portably be done, why do you think you need to do this?

As far as gcc goes, from the documentation:

"Assuming you have no file foo.h, the command
touch foo.h; cpp -dM foo.h
will show all the predefined macros."

The options used will affect that result. For ex. on my system:

[1] c:\c\junk>cpp -dM -W -Wall -ansi -pedantic empty.c
#define __HAVE_BUILTIN_SETJMP__ 1
#define __unix__ 1
#define __i386__ 1
#define __SIZE_TYPE__ long unsigned int
#define __DJGPP 2
#define __USER_LABEL_PREFIX__ _
#define __tune_pentium__ 1
#define __STDC_HOSTED__ 1
#define __MSDOS__ 1
#define DJGPP 2
#define __WCHAR_TYPE__ short unsigned int
#define __DJGPP__ 2
#define __WINT_TYPE__ int
#define __tune_i586__ 1
#define __DJGPP_MINOR__ 3
#define __STRICT_ANSI__ 1
#define __GO32__ 1
#define DJGPP_MINOR 3
#define __STDC__ 1
#define __PTRDIFF_TYPE__ int
#define __DJGPP_MINOR 3
#define __REGISTER_PREFIX__
#define __NO_INLINE__ 1
#define __i386 1
#define __VERSION__ "3.2.1"
 
K

Kenny McCormack

This cannot portably be done, why do you think you need to do this?

As far as gcc goes, from the documentation:

"Assuming you have no file foo.h, the command
touch foo.h; cpp -dM foo.h
will show all the predefined macros."

I think this can be simplified to: cpp -dM /dev/null
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top