Jump to content

predefined macros

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Guest_x42_*

Guest_x42_*
  • Guests
I know that in c++ there are a few predefined macros, and I want to take apart the stdlib to see how it works, and I think I should do this by trying to go through all of the preprocessor statements, and I want to know if there are any other macros that are already defined that I should know about
here are the ones I already know about:

__cplusplus

and that is about it

#2
manux

manux

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 234 posts
I googled compiler macros:
Pre-defined C/C++ Compiler Macros, seems a fair list.

But the most common I can think of:

Quote

__LINE__ Integer value representing the current line in the source code file being compiled.
__FILE__ A string literal containing the presumed name of the source file being compiled.
__DATE__ A string literal in the form "Mmm dd yyyy" containing the date in which the compilation process began.
__TIME__ A string literal in the form "hh:mm:ss" containing the time at which the compilation process began.


#3
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
You can also use __VA_ARGS__ to use with variadic macros (#define macros that can take a variable number of arguments).
sudo rm -rf /




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users