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: Wed, 15 Apr 2026 15:34:07 -0700 Organization: None to speak of Lines: 34 Message-ID: <87se8vvoo0.fsf@example.invalid> References: <3a3462bdd72c4ed9d392a78b7d369a7b5ccc3b04.camel@gmail.com> <87jyu9tbq9.fsf@example.invalid> <722ff6ff518fe213dd47b392d325dd4cde27c71e.camel@gmail.com> <874ilcx245.fsf@example.invalid> <6cdcb0cb48526baf40b07cb7853d64c9b25c8fd2.camel@gmail.com> <10rnq9g$qgv9$2@dont-email.me> <7da922d007ccbdda1d0727e31578f8cee04e7a30.camel@gmail.com> <10ro4c9$qsu2$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 15 Apr 2026 22:34:08 +0000 (UTC) Injection-Info: dont-email.me; posting-host="1e0bef0e1ec57bd67eb672eeef0be697"; logging-data="1334517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UCGSNrqj3Ep3ia26Fgshr" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:/jMB7agcNN0Uq0yqx+tzFvUfBVM= sha1:HokngoXD44uzC0DQJN34RbDZPyE= Xref: csiph.com comp.lang.c:397561 wij writes: > On Wed, 2026-04-15 at 15:38 +0200, David Brown wrote: [...] >> In C, when you write the code above there is /nothing/ to suggest that >> there should be two actions.   > > As I know, 'old-time' C has no optimization. I'm not sure that's even meaningful. A C compiler translates C source code to assembly or machine code. That's a non-trivial transformation. I'm not sure you can even say that such a transformation doesn't optimize anything. But ok, given `n = 0; n = 0;` a C compiler *may or may not* generate two stores to n. If it generates just one, that's an optimization. But the point is that that kind of optimization is not specified by the language. For every assembler I've encoutered, such optimizations are simply not implemented. [...] >> In assembly languages, if you write >> the equivalent of "p2 = 0;" twice, you get the appropriate opcode twice. > > Assembly compiler (or language) can also do the same optimization. Oh? Name a real-world assembler (not from your imagination) that does that kind of optimization. I'd like to read its manual. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */