c++ - DMC++ doesn't support static assertions
- Matthew Wilson (16/16) Jun 18 2003 The following compiles:
The following compiles: int main() { int a1[0]; int a2[-1]; return 0; } Borland, Intel, VC++, Watcom, Metrowerks all refuse to compile the first line (as well as the second). GCC accepts a zero length array but not a negative one. Digital Mars compiles both without issue, which renders the static assert mechanism inert. #define stlsoft_static_assert(_x) do { typedef int ai[(_x) ? 1 : -1]; } while(0) Is this an accepted error. Can (will) it be fixed such that one or the other (0 or -ve) can produce an error
Jun 18 2003