Kroma
Kroma

Reputation: 1151

C - preprocessors multiple macros

Gcc 4.8.x - 4.9.x

Hello,

I would like to merge multiple macros in a #ifdef directive, e.g :

#ifdef PLOT || GRAPH
..mycode..
#endif

But it doesn't work.

How may I achieve this ?

This is not an option :

#ifdef PLOT
#ifdef GRAPH
..mycode..
#endif
#endif

because if plot is defined and not graph, lost.

Thanks

Upvotes: 1

Views: 150

Answers (1)

mrks
mrks

Reputation: 8343

You can use this syntax:

#if defined(PLOT) || defined(GRAPH)

Upvotes: 3

Related Questions