Predefined macros, Examples – Zilog EZ80F916 User Manual
Page 168

UM014423-0607
Using the ANSI C-Compiler
ZiLOG Developer Studio II
eZ80Acclaim!
®
User Manual
148
PREDEFINED MACROS
The eZ80Acclaim! C-Compiler comes with the following standard predefined macro
names:
None of these macro names can be the subject of a
#define
or a
#undef
preprocessing
directive. The values of these predefined macros (except for
__LINE__
and
__FILE__
)
remain constant throughout the translation unit.
The following additional macros are predefined by the eZ80Acclaim! C-Compiler:
All predefined macro names begin with two underscores and end with two underscores.
Examples
The following program illustrates the use of some of these predefined macros:
#include
void main()
__DATE__
This macro expands to the current date in the format “Mmm dd yyyy” (a
character string literal), where the names of the months are the same as those
generated by the asctime function and the first character of dd is a space
character if the value is less than 10.
__FILE__ This
macro
expands to the current source file name (a string literal).
__LINE__
This macro expands to the current line number (a decimal constant).
__STDC__
This macro is defined as the decimal constant 1 and indicates conformance
with ANSI C.
__TIME__
This macro expands to the compilation time in the format “hh:mm:ss” (a string
literal).
__ACCLAIM__
This macro is defined and set to 1 for the eZ80Acclaim! compiler and
is otherwise undefined.
__EZ80__
This macro is defined and set to 1 for the eZ80Acclaim! compiler and
is otherwise undefined.
__FPLIB__
This macro is defined on all ZiLOG compilers and indicates whether
the floating-point library is available.
__ZDATE__
This macro expands to the build date of the compiler in the format
YYYYMMDD. For example, if the compiler were built on May 31,
2006, then __ZDATE__ expands to 20060531. This macro gives a
means to test for a particular ZiLOG release or to test that the
compiler is released after a new feature has been added.
__ZILOG__
This macro is defined and set to 1 on all ZiLOG compilers to indicate
that the compiler is provided by ZiLOG rather than some other
vendor.