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]

Re: [PATCH B2/2] Use builtin_unreachable in assert


> i'm not sure this is the way to go.  the expectation (as required by POSIX)
> is that you're guaranteed there are no side-effects when NDEBUG is applied
> to assert.  by using __builtin_unreachable, that is no longer the case.

The requirement (which should be in ISO C, not in POSIX) is specified at
the C language level.  "No side effects" at the C level certainly does not
preclude a different correct translation of the program to machine code.

> the code shrinkage is attractive, but the other factors considered (and that 
> NDEBUG usage in glibc in general is uncommon) leads me to think this path is 
> not worth the pain.

In fact, many distributions build libc with -DNDEBUG.  In terms of quantity
of execution that happens, I'd bet most use of libc is with -DNDEBUG.


Thanks,
Roland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]