This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 01/06/2015 08:35 AM, Richard Henderson wrote:
I do wonder about the public header file using an expression like __ASSERT_VOID_CAST (0 && (expr)) Side effects are not evaluated, but identifiers referenced in the expression still get marked as "used", etc.
Just as a heads-up, the GNU Emacs internals have a macro 'eassert' that does that, and it works well; we prefer it to 'assert'. There's also a macro 'eassume' that uses __builtin_unreachable; we tried having eassert do that too, but it led to too many compile-time false-alarms.
However, the C Standard doesn't allow eassert's implementation 'assert', as it requires that if NDEBUG is defined, then 'assert' must be defined via '#define assert(x) ((void)0)', which means weird uses like 'assert(***)' have to work.
Perhaps the public header file could use '0 && (expr)' only when in standards-conforming mode?
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |