What do the brackets mean in the #if specific preprocessor statement?

(I am working on an SDK in which I have the specific SDK code in the link and I cannot track the program flow.)

What is he doing

#if defined (AR7x00)

mean? In particular, what is the purpose of parentheses in such a preprocessor statement?

+3
source share
3 answers

These are three preprocessor directives:

#if defined (AR7x00)

#if defined AR7x00

#ifdef AR7x00

all mean the same thing: the following code should only be processed if a macro is currently defined AR7x00.

The directive #ifdef ...is just a convenient alternative #if defined .... There is also a directive #ifndef ...; #ifndef FOOequivalently #if ! defined FOO.

, defined , . , ; , . ( K & R defined. , .)

, , ; defined, #if. , :

#if defined ((AR7x00))

.

+7

gnu.org online docs , defined .

MSDN #if:

.

, , .

+2

, . ,

#if  defined( foo )  || defined( bar )
#error SOME PROBLEM
#endif

- gnu-arm-gcc,

#if defined foo || defined bar
#error SOME PROBLEM
#endif

, , , , , "foo" / "bar" #defined.

+1

All Articles