autoconf: Specific Compiler Characteristics

1 
1 5.10.1 Specific Compiler Characteristics
1 ----------------------------------------
1 
1 Some compilers exhibit different behaviors.
1 
1 Static/Dynamic Expressions
1      Autoconf relies on a trick to extract one bit of information from
1      the C compiler: using negative array sizes.  For instance the
1      following excerpt of a C source demonstrates how to test whether
1      `int' objects are 4 bytes wide:
1 
1           static int test_array[sizeof (int) == 4 ? 1 : -1];
1 
1      To our knowledge, there is a single compiler that does not support
1      this trick: the HP C compilers (the real ones, not only the
1      "bundled") on HP-UX 11.00.  They incorrectly reject the above
1      program with the diagnostic "Variable-length arrays cannot have
1      static storage."  This bug comes from HP compilers' mishandling of
1      `sizeof (int)', not from the `? 1 : -1', and Autoconf works around
1      this problem by casting `sizeof (int)' to `long int' before
1      comparing it.
1