mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jens Gustedt <jens.gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: Re: time.h define NULL
Date: Tue, 02 Jun 2015 13:32:58 +0200	[thread overview]
Message-ID: <1433244778.3572.3.camel@inria.fr> (raw)
In-Reply-To: <1433243791.2010.21.camel@xiaoka.com>

[-- Attachment #1: Type: text/plain, Size: 1423 bytes --]

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 ::




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

      parent reply	other threads:[~2015-06-02 11:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02  9:09 Tomasz Sterna
2015-06-02  9:35 ` Szabolcs Nagy
2015-06-02  9:38   ` Daniel Cegiełka
2015-06-02  9:41     ` Szabolcs Nagy
2015-06-02 11:16   ` Tomasz Sterna
2015-06-02 11:24     ` Szabolcs Nagy
2015-06-02 12:04       ` Tomasz Sterna
2015-06-02 15:57         ` stable 1.1.9 & current GIT broken on mips Sebastian Gottschall
2015-06-02 17:19           ` Rich Felker
2015-06-02 17:52             ` Sebastian Gottschall
2015-06-02 19:11               ` Rich Felker
2015-06-02 19:59                 ` Sebastian Gottschall
2015-06-04  4:04                   ` Rich Felker
2015-06-04  8:29                     ` Sebastian Gottschall
2015-06-04 12:14                     ` Sebastian Gottschall
2015-06-04 16:07                       ` Rich Felker
2015-06-06 15:42                         ` Anthony G. Basile
2015-06-06 15:59                           ` Anthony G. Basile
2015-06-02 11:32     ` Jens Gustedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433244778.3572.3.camel@inria.fr \
    --to=jens.gustedt@inria.fr \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).