This is the mail archive of the
mailing list for the GCC project.
Re: ANSI C / assignment makes pointer from integer
- To: fjh at cs dot mu dot oz dot au
- Subject: Re: ANSI C / assignment makes pointer from integer
- From: Sebastian Ude <ude at handshake dot de>
- Date: Tue, 07 Aug 2001 15:37:24 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <20010807223911.A28557@hg.cs.mu.oz.au>
- Reply-To: ude at handshake dot de
On Tue, 7 Aug 2001, firstname.lastname@example.org (Fergus Henderson) wrote:
> Date: Tue, 7 Aug 2001 22:39:11 +1000
> To: Bohdan Vlasyuk <email@example.com>
> From: firstname.lastname@example.org (Fergus Henderson)
> CC: Sebastian Ude <email@example.com>, firstname.lastname@example.org
> Subject: Re: ANSI C / assignment makes pointer from integer
> Actually it's a bit more complicated than that.
> strdup() is a non-standard function, so as well as #including <string.h>,
> you also need to compile with the right options; if you compile with
> `ansi', then strdup() will not be declared even if you #include
> If you want to write standard-conforming code, don't use strdup().
> The simplest solution is to write a version of strdup() yourself,
> name it something different, e.g. `sebastian_strdup()', and use that.
In fact, the strdup manual page says that it's a BSD / SVID invention, but
it seems not to be defined through the ISO / ANSI C standard.
Compiling with -Wimplicit-function-declaration made the whole situation a
lot clearer - why isn't this warning enabled by default ?