Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: A thought of C Date: Thu, 16 Apr 2026 14:33:32 -0700 Organization: None to speak of Lines: 39 Message-ID: <87se8utwsz.fsf@example.invalid> References: <3a3462bdd72c4ed9d392a78b7d369a7b5ccc3b04.camel@gmail.com> <10rluf2$9ooq$1@dont-email.me> <4d73f54ada2ef60b199c9811703a0a6e2b1a132f.camel@gmail.com> <10rmcat$erho$1@dont-email.me> <10rmejs$v392$5@dont-email.me> <10rmisi$gp6n$1@dont-email.me> <10rqdkk$16fat$1@dont-email.me> <10rrjdf$200uq$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Thu, 16 Apr 2026 21:33:33 +0000 (UTC) Injection-Info: dont-email.me; posting-host="4077b65989a1951a67b9804605790a41"; logging-data="2106634"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DCJkvdkWPbAprZqYQXh+f" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:01dD1sd6vTMrUgCtOpZWHTqf3iQ= sha1:XK7faIuIvZkB709gZK7MUdDV5K0= Xref: csiph.com comp.lang.c:397619 Bart writes: > On 16/04/2026 11:28, James Kuyper wrote: >> On 15/04/2026 01:33, Bart wrote: >> ... >>> * Not allowing (until standardised after half a century) binary >>> literals, and still not allowing those to be printed >> The latest draft standard supports %b and %B formats. >> ... >>> * Not being allowed to do a dozen things that you KNOW are well-defined >>> on your target machine, but C says are UB. >> If you know they are well-defined on your only target platform, >> there's >> nothing wrong with writing such code. That's part of the reason why C >> says the behavior is undefined, rather than requiring that such code be >> rejected. Implementations are intended to take advantage of that fact >> for code that does not need to be portable. > > Taking advantage in what way? Doing something entirely unexpected or > unintuitive? No, of course not. > /That's/ the problem! James's point is that any behavior that is not defined by the standard can still be defined by an implementation. For example, signed integer overflow is undefined, but an implementation could define it as 2's-complement wraparound, so for example INT_MAX + 1 == INT_MIN. If an implementation guarantees that, there's nothing wrong with an application relying on that guarantee (with the proviso that the code is not portable to implementations that don't make that guarantee). This assumes that there's a real advantage in relying on the behavior specified by the implementation. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */