Question 10.12

How can I construct preprocessor #if expressions which compare strings?


You can't do it directly; preprocessor #if arithmetic uses only integers. You can #define several manifest constants, however, and implement conditionals on those.

See also question 20.17.

References: K&R2 Sec. 4.11.3 p. 91
ANSI Sec. 3.8.1
ISO Sec. 6.8.1
H&S Sec. 7.11.1 p. 225


Read sequentially: prev next up top


This page by Steve Summit // Copyright 1995 // mail feedback