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


On 09 Jan 2015 10:16, Richard Henderson wrote:
> Finally, use __builtin_unreachable to tell the compiler about
> impossible paths.

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.

yes, assert in this context is internal to glibc and so doesn't have to conform 
to POSIX directly.  but i think forcing developers to remember this kind of 
nuance just leads to bugs, especially when you consider glibc imports code from 
other projects (like gnulib).

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.
-mike

Attachment: signature.asc
Description: Digital signature


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