System/ Compiler specific macros

Discussion in 'C Programming' started by vsnadagouda@gmail.com, Jul 4, 2005.

  1. Guest

    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
    , Jul 4, 2005
    #1
    1. Advertising

  2. Grumble Guest

    wrote:

    > 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.
    Grumble, Jul 5, 2005
    #2
    1. Advertising

  3. wrote:
    > 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
    Robert Gamble, Jul 5, 2005
    #3
  4. wrote:
    > 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
    Robert Gamble, Jul 5, 2005
    #4
  5. CBFalconer Guest

    Robert Gamble wrote:
    > wrote:
    >>
    >> 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 way) and figure out all the system and compiler specific
    >> 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."


    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"

    --
    "If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers." - Keith Thompson
    CBFalconer, Jul 5, 2005
    #5
  6. In article <>,
    Robert Gamble <> wrote:
    > wrote:
    >> 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."


    I think this can be simplified to: cpp -dM /dev/null
    Kenny McCormack, Jul 6, 2005
    #6
  7. In article <dafd1t$2d4$>,
    Kenny McCormack <> wrote:
    >
    >
    > In article <>,
    > Robert Gamble <> wrote:
    > >
    > >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


    On unix-like platforms.
    --
    7842++
    Anonymous 7843, Jul 6, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    80
    Views:
    2,416
    Stephen J. Bevan
    Nov 7, 2003
  2. Replies:
    1
    Views:
    438
    Marco Antoniotti
    Oct 7, 2003
  3. Replies:
    5
    Views:
    493
  4. Michael T. Babcock

    Re: Explanation of macros; Haskell macros

    Michael T. Babcock, Nov 3, 2003, in forum: Python
    Replies:
    0
    Views:
    515
    Michael T. Babcock
    Nov 3, 2003
  5. Andrew Arro

    macros-loop? calling macros X times?

    Andrew Arro, Jul 23, 2004, in forum: C Programming
    Replies:
    2
    Views:
    488
    S.Tobias
    Jul 24, 2004
Loading...

Share This Page