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

Macros
Java API
Legal
Contact Us

 

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 | #elseif ] 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
    #elseif
    Used when evaluating an expression. Only evaluated when the preceding if, elif or elseif directives evaluate to false.
    #else Used only used when the preceding #if, #ifdef, #ifndef, #elif or elseif directives evaluate to false.
    #endif Used to end #if, #ifdef and #ifndef directives.
    expression the expression to evaluate.
    identifier the identifier to check for existence.
    statement the statement(s) to compile when the preceding #if, #ifdef, #ifndef, #elif or elseif 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
Copyright © 1998-2005 Servertec. All rights reserved.
Privacy Statement.
Last Modified: Sun Sep 04 14:56:03 EDT 2005