[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [issues] glibc uses '__unused' as identifier, which is traditionally used by BSD as macro



Joseph S. Myers dixit:

>A portable application should not be making use of symbols in the 
>implementation namespace, such as __unused; they should only be used by 
>the implementation (compiler, libc, libstdc++ etc.) which need to 
>coordinate with each other on how they are used.

Exactly. It's not a portable application. It's part of the standard
BSD userland plus some things found in BSD libc but not GNU libc.
On BSD, macros like __BEGIN_DECLS and __unused are standardised
(pretty much - others like __RCSID aren't quite yet).

As this has only *VERY* recently become an issue, I think both
Linux and glibc could afford to refrain from using "__unused"
for compatibility / historic reasons. I don't see any cost as-
sociated with it, only benefit.

Making portable applications out of BSD userland is a different
task, and for some things I'm going that way (like mksh), but to
merely "just quickly compile" something like paxtar, our improved
cksum, or similar, it's overkill.

I think it could be seen as a sign of friendly recognisation for
eglibc to honour the BSD convention - maybe even define __unused
to __attribute__((unused)) or the used compiler's equivalent itself
once the Linux kernel header case is solved as well. (Maybe not
though - to disrecommend using it in new code. On the other hand,
"we sell the rope to hang yourself".) I added things like getline
and strndup to MirBSD libc as well, for improved glibc compatibility.

bye,
//mirabilos
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2