FYI: strdup() -> xstrdup()

Andrew Cagney ac131313@cygnus.com
Mon Nov 22 14:56:00 GMT 1999


DJ Delorie wrote:
> 
> > Strdup is a standard function,
> 
> It's neither ANSI nor POSIX.1(1990).  Is it finally in some other
> spec?

HISTORY
     The strdup() function first appeared in 4.4BSD.

> 
> > and a year from now somebody will forget about xstrdup and use the
> > standard function instead.
> 
> #define strdup dont_use_strdup__use_xstrdup_instead
> 
> ...
> 
> #undef strdup
> strdup()
> {
>   dont_use_strdup__use_xstrdup_instead();
> }

I considered suggesting this but bit my lip :-)  Now that it is on the
table though, it's fine with me.

	Andrew


More information about the Gdb-patches mailing list