Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Small challenge: sort names
Date: Sun, 12 Apr 2026 06:48:19 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <86o6jo8f30.fsf@linuxsc.com>
References: <10r4h6o$396qn$1@dont-email.me> <10r537m$in2o$4@dont-email.me> <10r5vh2$3mo17$2@dont-email.me> <10r64uq$3pf3r$1@dont-email.me> <20260409001030.000006c9@yahoo.com> <86h5pkww9a.fsf@linuxsc.com> <87cy0832zp.fsf@example.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Sun, 12 Apr 2026 13:48:20 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="425f3de481b107cac4c4e410f9a2c2b8"; logging-data="2689433"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tOh6YKxDxXjw+xkRPfDOB1AVgk1xHOGs="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:7GDUrwTq8JozElhD3LRcQEFBK6s= sha1:O19JT34d7mfytOtwtNJvThjIwgA=
Xref: csiph.com comp.lang.c:397504
Keith Thompson writes:
> Tim Rentsch writes:
> [...]
>
>> The semantics of !ptr has been codified to mean 1 for null pointers
>> since the original C standard. Heck, even during the 1970s when C
>> allowed assigning integers directly to pointers, K&R said that
>> assigning 0 to a pointer produces a pointer guaranteed to be
>> different than a pointer to any object. Any C implementation where
>> !ptr does the wrong thing should be avoided like the plague.
>
> Any C implementation where !ptr does the wrong thing almost certainly
> does not exist. It's difficult to imagine that a C compiler with
> such a fundamental bug would ever go out the door.
My usual preference is to draw conclusions based on evidence rather
imagination or supposition.
> It's barely possible that compiler that uses a representation other
> than all-bits-zero for null pointers might have such a bug, but
> (a) anyone creating such an implementation will almost certainly
> be extremely careful to get such things right, and (b) I'm not sure
> that any such compilers even exist, except perhaps for old systems
> that would be considered exotic today.
Here again this sounds like just supposition. How much experience
do you have, and how extensive, using non-mainstream C compilers?
For myself I can't say I much at all, but I have seen one where
believe it or not assert() was implemented wrongly. assert()! I
certainly wouldn't have guessed that before actually seeing it.