bug-gnulib
[Top][All Lists]
Advanced

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

Re: new gnulib module "verify" for compile-time assertions


From: Bruno Haible
Subject: Re: new gnulib module "verify" for compile-time assertions
Date: Wed, 28 Sep 2005 13:57:09 +0200
User-agent: KMail/1.5

Paul Eggert wrote:
> Something like this:
>
> enum {
>   abc = (verify_true (1 + 1 == 2) ? 7 : UINT_MAX)
> };

Thanks. I see: you avoid a expression of type 'void', because such an
expression can only be used in a "comma expression", and a "comma expression"
is not valid inside an enum initializer.

One can also avoid the strange UINT_MAX alternative by doing

enum {
  abc = verify_true (1 + 1 == 2) * 0 + 7
};

I'm adding this to the test cases in tests/test-verify.c.
  
Bruno





reply via email to

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