Next Previous Contents

6. Predefined macros

The compiler defines several macros at startup:

__APPLE2__

This macro is defined if the target is the Apple ][ (-t apple2).

__APPLE2ENH__

This macro is defined if the target is the enhanced Apple //e (-t apple2enh).

__ATARI__

This macro is defined if the target is one of the Atari computers (400/800/130XL/800XL).

__ATMOS__

This macro is defined if the target is the Oric Atmos (-t atmos).

__C128__

This macro is defined if the target is the c128 (-t c128).

__C16__

This macro is defined if the target is the c16 (-t c16).

__C64__

This macro is defined if the target is the c64 (-t c64).

__CBM__

This macro is defined if the target system is one of the CBM targets.

__CBM510__

This macro is defined if the target is the CBM 500 series of computers.

__CBM610__

This macro is defined if the target is one of the CBM 600/700 family of computers (called B series in the US).

__CC65__

This macro is always defined. Its value is the version number of the compiler in hex. For example, version 2.10.1 of the compiler has this macro defined as 0x02A1.

__CC65_STD__

This macro is defined to one of the following depending on the --standard command line option:

__DATE__

This macro expands to the date of translation of the preprocessing translation unit in the form "Mmm dd yyyy".

__FILE__

This macro expands to a string containing the name of the C source file.

__GEOS__

This macro is defined if you are compiling for the GEOS system (-t geos).

__LINE__

This macro expands to the current line number.

__LUNIX__

This macro is defined if you are compiling for the LUnix system (-t lunix).

__LYNX__

This macro is defined if the target is the Atari Lynx (-t lynx).

__NES__

This macro is defined if the target is the NES (-t nes).

__OPT__

Is defined if the compiler was called with the -O command line option.

__OPT_i__

Is defined if the compiler was called with the -Oi command line option.

__OPT_r__

Is defined if the compiler was called with the -Or command line option.

__OPT_s__

Is defined if the compiler was called with the -Os command line option.

__PET__

This macro is defined if the target is the PET family of computers (-t pet).

__PLUS4__

This macro is defined if the target is the plus/4 (-t plus4).

__STDC_HOSTED__

This macro is expands to the integer constant 1.

__SUPERVISION__

This macro is defined if the target is the supervision (-t supervision).

__TIME__

This macro expands to the time of translation of the preprocessing translation unit in the form "hh:mm:ss".

__VIC20__

This macro is defined if the target is the vic20 (-t vic20).


Next Previous Contents