TITLE: sizeof in an #if directive PROBLEM: Brian Leach My compiler (HP Softbench C++, HP-UX 9.05 does not allow the sizeof operator in a #if statement. Short of: #define SIZEOFUNSIGNED 4 #define SIZEOFFLOAT 4 which must be maintained manually, does anyone have an idea how I can automagically make the #if do what I desire? [ The following code will stop at compile time with a divide by zero error. -adc ] RESPONSE: Valentin Bonnard (bonnardv@pratique.fr) I think this will work, and will generate the same code (no code at all): enum { testSizeof = 1 / (sizeof (long) == sizeof (float) }; ^^^^ It will work on compilers where ints are 16 bits