[systemd-devel] [bug] (char*)NULL should be used in variadic functions
Vasily Kulikov
segoon at openwall.com
Sun Feb 17 08:40:46 PST 2013
On Mon, Feb 04, 2013 at 20:22 +0100, Lennart Poettering wrote:
> On Mon, 04.02.13 11:37, Michał Bartoszkiewicz (mbartoszkiewicz at gmail.com) wrote:
>
> >
> > On Mon, Feb 4, 2013 at 11:15 AM, Lennart Poettering
> > <lennart at poettering.net> wrote:
> > > We actually care about readability of the sources and non-Linux systems
> > > are out-of-focus for us. Can you tell me which Linux system has
> > > sizeof(void*) != sizeof(char*)? Otherwise, I only see this as pointless
> > > excercise of making our sources less readable...
> > >
> > > Or am I missing something here?
> >
> > I believe it is legal (but glibc doesn't seem to do it) to define NULL
> > simply as 0, so sizeof NULL == sizeof(int), which can be different
> > from sizeof(void*).
Yes.
Some reasoning about using NULL and (theoretically) possible
implementations:
http://www.c-faq.com/null/index.html
Especially, 5.4, 5.6, 5.7, 5.11, 5.13.
> Be that as it may, for us only Linux is relevant, and that implies glibc
> (or some other implementation of libc that implements the very same
> interfaces.)
Why does any Linux libc must implement the very same ABI? Binary
compatibility is an advantage of libc which might be very helpful in new
libc propagation, etc. etc., but it's totally irrelevant to applications.
--
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments
More information about the systemd-devel
mailing list