Does the sizeof operator work in preprocessor if directives?

Q

Does the sizeof operator work in preprocessor if directives?

✍: Guest

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;

2016-02-03, 1261👍, 0💬