prev up next   top/contents search

comp.lang.c FAQ list · Question 10.13

Q: Does the sizeof operator work in preprocessor #if directives?

A: No. Preprocessing happens during an earlier phase of compilation, before type names have been parsed. Instead of sizeof, consider using the predefined constants in ANSI's <limits.h>, if applicable, or perhaps a ``configure'' script. (Better yet, try to write code which is inherently insensitive to type sizes; see also questions 1.1 and 1.3.)

Additional links: nice explanation by Chris Torek

References: ISO Sec., Sec. 6.8.1
H&S Sec. 7.11.1 p. 225

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

Hosted by Eskimo North