www.digitalmars.com         C & C++   DMDScript  

c++ - DMC++ doesn't support static assertions

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