Predefined preprocessor symbols

Chapter 8:Preprocessor And Complex Declarations

    Predefined preprocessor symbols

  •            A lot of simple macros are predefined. They can be used without giving their definitions. They classified into 2 groups: The first group contains macros defined by the ANSI standard for the C programming language. The second group contains macros provided by C for AIX.

    ANSI Standard Predefined Preprocessor Macros

    Name and Explanation

     

                  __LINE__           

    An integer shows the current source line number. Its value alters during compilation as the compiler processes following lines of the program. It can be put with the #line directive.

                  __FILE__

    A character string literal holds the name of the source file. Its value modifies as the compiler processes include files that are portion of the program. It can be located with the #line directive.

                 


                   __DATE__

    A character string literal has the date if the source file was compiled. Its value alters as the compiler processes any file of the program. The form of date:  "Mmm dd yyyy"

    o:p> 

    where:

    o:p> 

    Mmm      indicates the month in an shortened form (Jan, Feb, Mar, Apr,    May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec).

    dd          indicates the day. The first d is a blank character when the day is less than10.

    yyyy       indicates the year.

                  __STDC__  

    The integer 1 shows that the C compiler conforms to the ANSI standard. It is undefined if the language level is set to anything other than ANSI.

                  


                  __TIME__

    A character string literal contains the time when the source file was compiled. Its value varies as the compiler processes any file of source program. The form is hh:mm:ss

    where:

    hh     hour.

    mm     minutes.

    ss     seconds.

    Always, the time is set to the system time.

                 

     



                  __TIMESTAMP__

    A character string literal holding the date and time when the source file was last changed. Its value alters as the compiler process the part of source program. The form is  Day Mmm dd hh:mm:ss yyyy

    where:

    Day       The day of the week. [Mon, Tue, Wed, Thu, Fri, Sat, or Sun]

    Mmm     The month in an shortened form [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec].

    dd         The day of the month. If the day is less than 10, the first d is a blank character.

    hh          hour.

    mm        minutes.

    ss          seconds.

    yyyy      year.

    It always set to the system date and time.

    C for AIX Predefined Preprocessor Macros

    Name  and  Explanation
    __64BIT__

     

    Defined if the compiler is called to compile in 64-bit mode. It should not be user-defined or redefined.

    _AIX32

     

    Defined if the operating system is AIX version 3.2 or superior.

    _AIX41

     

    Defined if the operating system is AIX version 4.1 or advanced.

    _AIX43

     

    Defined if the operating system is AIX version 4.3 or higher.

    __ANSI__

     

    Permits only language constructs that conform to ANSI C standards. Defined using the #pragma langlvl directive or the -qlanglvl compiler option.

    _ARCH_*

     

    Specifies that the compiler creates code to run on the family of processors indicated by *.

      _CHAR_SIGNED

     

    Tells that the default character type is signed.

     _CHAR_UNSIGNED

     

    Shows that the default character type is unsigned.

     __CLASSIC__

     

    Defined using the #pragma langlvl directive or the -qlanglvl compiler option if the classic language level is mentioned.

      __EXTENDED__

     

    Permits extra language constructs offered by the C for AIX implementation. The #pragma langlvl directive or the -qlanglvl compiler option is used to define it.

     __FUNCTION__

     

    Points the name of the function being compiled.

     __HOS_AIX__

     

    Tells the host operating system is AIX.

     __IBMC__

     

    It holds the version number of the compiler, e.g. __IBMC__=450. It should be used in new code.

     __IBMSMP

     

    It is defined when the -qsmp compiler option is chosen.

     _ILP32

     

    Defined if the compiler is using the 32-bit data model. It should not be user-defined or redefined.

     _LONG_LONG

     

    It is defined when the compiler is in a mode that allows long long int and unsigned long long int types.

     _LONGDOUBLE128

     

    Places the number of bits to use when signifying the value of a long double. The accessible choices are 64 and 128 bits.

     _LP64

     

    Defined if the compiler is using the 64-bit data model. It should not be user - defined or redefined.

     __MATH__

     

    Informs the compiler to make alternative code for calls to some math functions existing in the standard C runtime libraries, if suitable. The     functions handled this method are defined as alternate text for macros that begin with two underscores (__) in the /usr/vac/include/math.h header file.

     _OPENMP

     

    Defined when the -qsmp=omp compiler choice is set to enable full observance to the OpenMP API specification.

     _POWER    

     

    Specifies the operating system is AIX 4.1 or higher.

     __SAA__

     

    Defined using the #pragma langlvl directive or the –qlanglvl compiler option. It permits only language constructs that conform to the most current level of the SAA C standards.

     __SAAL2__

     

    Defined using the #pragma langlvl directive or the -qlanglvl compiler option and it permits only language constructs that conform to the most latest level of the SAA Level 2 C standards.

     __STR__

     

    Informs the compiler to make alternative code for calls to some string functions existing in the standard C runtime libraries, if suitable. The    functions handled this manner are defined as substitute text for macros that start with 2underscores (__) in the /usr/vac/include/string.h header file.

     __THW_INTEL__

     

    Tells that the target hardware is an Intel processor.

     __THW_RS6000__

     

    Point out that the target hardware is a RISC/6000 processor.

     __xlC__

     

    A hexadecimal constant holds the version number of the compiler. The form:   0xVVRR
    where:

     VV     The compiler version number.
     RR     The compiler release number.

     For C for AIX Version 5 Release 0, the macro has the value 0x0500.

     __XLC121__

    Instructs the compiler to produce alternative code for calls to some new string and math functions that are defined as replacement text for macros that start with 2 underscores (__) in the following header files:

    /usr/vac/include/string.h
    /usr/vac/include/math.h
    /usr/vac/include/stdlib.h
    /usr/vac/include/stream.h

© 2015 by Learncertification All Rights Reserved. The certification names are the trademarks of their respective owners. Terms & Privacy Policy