bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] verify: use _Static_assert if available


From: Paul Eggert
Subject: Re: [PATCH] verify: use _Static_assert if available
Date: Fri, 08 Apr 2011 10:03:41 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9

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

[Prev in Thread] Current Thread [Next in Thread]