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: Jim Meyering
Subject: Re: new gnulib module "verify" for compile-time assertions
Date: Fri, 23 Sep 2005 20:35:55 +0200

Paul Eggert <address@hidden> wrote:
...
> How about the following patch instead?  I installed it in gnulib and
> coreutils (though I suspect it may not be the last word, with all
> these screwy compilers to test....).
>
> 2005-09-23  Paul Eggert  <address@hidden>
>
>       * verify.h (GL_CONCAT0, GL_CONCAT): Remove.
>       (verify): Don't use the __LINE__ trick, as it doesn't work in general.
>       Instead, declare a function that returns a pointer to an array,
>       and use verify_type__ to declare the size of the array.
>       Problem and germ of a solution reported by Bruno Haible.
...
>  # define verify(R) \
> -    extern verify_type__ (R) GL_CONCAT (verify_function_, __LINE__) (void)
> +    extern int (* verify_function__ (void)) [sizeof (verify_type__ (R))]

Clever!
I hope it works.




reply via email to

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