This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [libobjc] Re: PATCH: objc-improvements-branch merge -- Part 2


Ziemowit Laski <zlaski@apple.com> writes:

>> Uh.  Due to the rather funky semantics of assert.h, it oughtn't to be
>> included by library headers, ever.
>
> Can you elaborate?  Today must be my day to learn about headers... :-)

Actually I take it back, I had misremembered what assert.h does.

The funkiness is that you can #include it multiple times, changing
whether NDEBUG is defined, to toggle assertions on and off in a
finegrained manner.  What I had thought was that it unconditionally
undefined NDEBUG, which would make it unsafe to include from library
headers because it would mess with the user's choices.

However, there's still a good reason not to include assert.h in
objc/sarray.h: it isn't necessary.  There are no calls to assert()
in that file.  There _are_ calls to assert in sarray.c, but it
includes assert.h on its own account.  Same for objc/runtime.h.

zw


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