Sujet : Re: Word For Today: “Uglification”
De : 433-929-6894 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 12. Mar 2024, 07:15:38
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240311231053.559@kylheku.com>
References : 1
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-03-12, Lawrence D'Oliveiro <
ldo@nz.invalid> wrote:
From /usr/include/«arch»/bits/select.h on my Debian system:
>
#define __FD_ZERO(s) \
do { \
unsigned int __i; \
fd_set *__arr = (s); \
for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
__FDS_BITS (__arr)[__i] = 0; \
} while (0)
>
Note how this macro brings the entire expression for “s” into the
scope containing those temporary “__i” and “__arr” variables. You just
better hope they won’t clash.
>
I think there is a clause in the C spec that says names beginning with
underscores (“uglified” names, I think they’re called) are reserved
for library implementors or something. But what happens if one library
implementation depends on another? What keeps the choices of names
from clashing in that situation? Just luck, I guess.
That doesn't happen. There is only one library that's part of the
language implementation, and those identifiers are reserved for that.
Any third party library that is not part of the implementation cannot
use these identifiers with the absolute certainty that they don't clash
with anything.
Standard C doesn't offer a solution for the problem of party library
writers needing private identifiers in their headers.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca