Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 02 Jun 2015 13:32:58 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: time.h define NULL

Am Dienstag, den 02.06.2015, 13:16 +0200 schrieb Tomasz Sterna:
> Dnia 2015-06-02, wto o godzinie 11:35 +0200, Szabolcs Nagy pisze:
> > > Why does time.h unconditionally define NULL [1]?
> > because it is required
> 
> Required by what?

because the C standard says so

> > > /usr/include/time.h:11:9: warning: 'NULL' macro redefined
> > > [-Wmacro-redefined]
> > > #define NULL 0L
> > >         ^
> > what is the previous definition?
> > and why is that conflicting?
> 
> Previous definition is:
> #define NULL (0)
> 
> it is in one of headers of the application I'm trying to build against
> musl.

This is a bug. An application should never redefine a standard macro

> Even if it is required by time.h, shouldn't it be guarded by #ifndef
> NULL? time.h is not stand-alone unit and is designed to be included to
> other software.

No. As you can see both defininitions are different, no only
syntactical, but also one has type int and the other long.

An application should never be able to overwrite a standard macro, but
things should error out as they do for you.

Jens



-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::




Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.