Re: Implicition declarations of functions and bugs
On 13-Mar-06, 15:27 (CST), Ben Pfaff <firstname.lastname@example.org> wrote:
> Steve Greenland <email@example.com> writes:
> > Not if the relevant header hasn't been included. No "#include
> > <string.h>", no compiler messing with "strdup()."
> You are misinformed. First, note that strdup() is not in the
> standard C library, but it is in the reserved str* name space.
Right. My assumption was that any implementation providing strdup()
would have use the the same namespace behaviour for strdup() as for any
standardized str*() function.
> Declaring strdup() with external linkage *always* yields
> undefined behavior. Declaring strdup() with internal linkage
> yields undefined behavior if <string.h> is included.
You're correct, I'd forgotten the distinction. Thanks.
Of course, one could argue that any code that expects to redefine strdup
as "int strdup()" is probably in need of help...
The irony is that Bill Gates claims to be making a stable operating
system and Linus Torvalds claims to be trying to take over the
world. -- seen on the net