On 04/08/2011 09:30 AM, Pádraig Brady wrote:
> So C++0x support in gcc 4.6.0 is using static_assert()
> while C1X support is using _Static_assert().
> Why the divergence in the standards?

Sorry, I don't know, as I don't use C++.

> Do we need to enforce the gcc option --std=c1x
> to enable this as you do?

No, it works just fine as-is: because _Static_assert begins with
an underscore followed by an upper-case letter, GCC is allowed to
(and does) support it even when conforming to older standards
(and now, possibly, I have answered your first question too :-):

$ cat t.c
#include <verify.h>
verify (0.0 < 1.0);
verify (1 < 0);
int x = verify_true (1 < 0);
int y = verify_true (x);
$ gcc -I. t.c
t.c:3:1: error: static assertion failed: "verify (1 < 0)"
t.c:4:9: error: static assertion failed: "verify_true (1 < 0)"
t.c:5:9: error: expression in static assertion is not constant
$ gcc -I. --std=c90 t.c
t.c:3:1: error: static assertion failed: "verify (1 < 0)"
t.c:4:9: error: static assertion failed: "verify_true (1 < 0)"
t.c:5:9: error: expression in static assertion is not constant

Reply via email to