prev up next   top/contents search

comp.lang.c FAQ list · Question 10.14

Q: Can I use an #ifdef in a #define line, to define something two different ways, like this?

	#define a b \
	#ifdef whatever
		c d
	#else
		e f g
	#endif


A: No. You can't ``run the preprocessor on itself,'' so to speak. What you can do is use one of two completely separate #define lines, depending on the #ifdef setting:

	#ifdef whatever
	#define a b c d
	#else
	#define a b e f g
	#endif

References: ISO Sec. 6.8.3, Sec. 6.8.3.4
H&S Sec. 3.2 pp. 40-1


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North