www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.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