Servertec #if
M E N U

Content
Introduction
Release Notes
Requirements
Installation
Change Log
Future Plans
Knowledge Base
Referance Manual
Conventions
Templates
Constants
Identifiers
Operators
Directives
## // /* */
#define
#error
#if{def|ndef}
#include
#message
#undef

iPP
Legal
Feedback

 


Used to control compilation of a block of statements when the specified expression evaluates to true.

Syntax

[ #if expression | #ifdef identifier | #ifndef identifier ]
{ statement }...
{#elif expression
{ statement }... }...
{#else
{ statement }... }
#endif

Notes

#if Used when evaluating an expression.
#ifdef Used to check if an identifier is defined.
#ifndef Used to check if an identifier is not defined.
#elif Used when evaluating an expression. Only evaluated when the preceding if or elif directives evaluate to false.
#else Used only used when the preceding #if, #ifdef, #ifndef or #elif directives evaluate to false.
#endif Used to end #if, #ifdef and #ifndef directives.
expression the expression to evaluate.
identifier the identifier to check for existance.
statement the statement(s) to compile when the preceding #if, #ifdef, #ifndef or #elif evaluates to true.

Example

#ifndef EOF
    #define EOF (-1)
#endif

#if VERSION == 1
    #include <v1sup.h>
#elif VERSION == 2
    #include <v2sup.h>
#elif VERSION == 3
    #include <v3sup.h>
#else
    #error version not supported
#endif
top of page
Built with iScript Copyright © 1997-1998 Servertec. All rights reserved.
Last Modified: Tue Jun 30 00:17:54 PDT 1998