[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem with inline functions in gsweb and clang
From: |
David Chisnall |
Subject: |
Re: problem with inline functions in gsweb and clang |
Date: |
Tue, 28 May 2013 10:18:57 +0100 |
On 27 May 2013, at 18:18, Ivan Vučica <ivucica@gmail.com> wrote:
> Somewhat off topic: I really like the following error; it's extremely
> professional and mature. Where is it coming from?
>
> /usr/local/lib/libgcrypt.so.18.0: warning: stpcpy() is dangerous GNU crap;
> don't use it
It's a linker error that is triggered by the presence of an attribute on a
function. The text is a reference to Ulrich Drepper's refusal to accept
patches to implement the strl* functions in glibc because they were
'inefficient BSD crap'.
It is 'dangerous', because it will NULL-terminate the string in some cases, but
not others. This means that you must always check the lengths of both strings
before calling it, at which point you may as well use memcpy, which will be
faster.
Note, however, that the GNU man page explicitly claims not to have invented
this function, and it is now part of POSIX2008 (Austin has a habit of
standardising bad ideas if two or more libcs have implemented them), so the
'GNU' in the warning is misleading.
David
-- Sent from my brain