Preprocessor Directives C++

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

#define conditional syntax

#define expression(a,b) a<b ? a:b

#define syntax

#define identifier replacement

# operator syntax example

#define str(x) #x // would put x in double quotes

error directive

#error

#error syntax

#error error_message

undefines macros

#undef

#undef syntax

#undef expression

__STD_HOSTED__

1 if the implementation is hosed, 0 otherwise

#ifdef and #endif

Includes the code of a macro is defined

Predefined macro syntax

__MACRO__ // (two underscores)

Hosted implementaiton

all standard headers available

Conditional Inclusions

allow to include or discard part of the code of a program if a certain condition is met

## operator

binary operator that concatenates two expressions leaving no space in between them inside double quotes

__cplusplus__

implementation integer of C++

#error

when encountered, generates an error message

#if syntax

#if condition code #endif

#ifdef syntax

#ifdef expression code #endif

Sourde file inclusion directive

#include

#line syntax

#line page_number "filename"

# operator

changes the following expression to in double quotes

#elif C++ equivalent

else if ()

__LINE__

int current line of the source file

Pragma directive

specifies diverse options to the compiler

__DATE__

string literal Current Date in Mmm dd yyyy

__TIME__

string literal of time hh:mm:ss

__FILE__

string literal prsumed name of the source file


Ensembles d'études connexes

Statistical Techniques in Business & Economics 17th E Chapter 2 Vocabulary

View Set

Kubler Ross' Five stages of grief

View Set

Penny Chapter 12 Review Questions

View Set

Chapter 2: Measurement and Problem Solving

View Set