GEOS SDK TechDocs
|
|
2.1 Goc File Types
|
2.3 Macros in Goc
@if, @ifdef, @ifndef, @endif
Many C programs use the directives
#if
,
#ifdef
,
#ifndef
, and
#endif
to define conditional code--code that should be compiled into the program only if certain conditions are met. When working with standard C code in your GEOS applications, you should still use these directives; when working with Goc code, however (in
.goh
and
.goc
files), you should use the Goc directives
@if
,
@ifdef
,
@ifndef
, and
@endif
.
Goc conditionals are more limited than C conditionals. Conditional expressions may be based on numbers, names of macros, and the Boolean operators OR (
||
) and AND (
&&
). Some examples of Goc conditional expressions are shown below:
@ifdef (MyMacro) /* code compiled if MyMacro is defined */ @endif
@if 0 /* code that will not be compiled at all */ @endif
@if defined(MyMacro) || MY_CONSTANT /* code compiled if either MyMacro is * defined or MY_CONSTANT is not zero */ @endif
@ifndef 0 /* code always compiled */ @endif
GEOS SDK TechDocs
|
|
2.1 Goc File Types
|
2.3 Macros in Goc