Article View: sci.electronics.design
Article #1058Re: Arms race
From: Don Y
Date: Wed, 11 Nov 2026 21:31
Date: Wed, 11 Nov 2026 21:31
77 lines
5188 bytes
5188 bytes
On 11/9/2026 2:14 PM, Waldek Hebisch wrote:
> Don Y <blockedofcourse@foo.invalid> wrote:
>> On 11/8/2026 12:27 PM, Waldek Hebisch wrote:
>>> You clearly go into area were you are not an expert. Google a
>>> bit about "undefined behaviour" in C and you will learn that
>>> when source code makes no sense, then C compier can do
>>> essentially anything, which in not so rare cases means that
>>> compiler simply deletes what programmer wrote. Explicit nop-s
>>
>> The compiler doesn't have THAT much license. It can't decide to
>> implement arbitrary operations just because you APPEAR to be
>> relying on a behavior that is undefined.
>
> Compiler just uses rules, so writing about appearence makes no
> sense. When optimizing compier performs a lot of transformations.
> Validity of transformations may depend on conditions. When
> checking conditions compiler assumes that program does not
> contain undefined behaviour.
>
> And yes, C standard gives such freedom to authors of C
> compilers:
>
> : undefined behavior
> : behavior, upon use of a nonportable or erroneous program construct
> : or of erroneous data, for which this document imposes no requirements
>
> Do I need to explain to you what "no requirements" mean?
No one (responsibly) builds things using modern C. Because
it is not a "practical" (as in "suitable for PRACTICE") language.
The same bit of source code written in a particular language
should result in the same general behavior regardless of processor
or compiler choice.
That contract was broken by C more than 20 years ago.
C is now an academic exercise and playground for c.l.c types.
All of my colleagues use C89 or K&R -- because we have to be able
to PROVE that the source code that the customer receives and
systematically reviews corresponds with what is happening in the
hardware.
Any "optimizations" have to be relatively trivial and intuitive
and visible at the preprocessor stage; the preprocessed output
should accuraely define what the code ACTUALLY does, not what the
developer HOPES it will do (subject to the compiler-writer's
whims).
Loop unrolling, function inlining, constant folding, constant
subexpression elimination, etc. -- all things that are OBVIOUS to
someone inspecting the source ("Yes, I understand that STRINGLENGTH+1
is intended to account for the NUL termination in a more visible manner"
or "OK, I see 3+3+4+1 is a good way of representing a telephone number"
or "Yeah, I guess you could do those steps N (constant) times in a row
instead of wrapping them in a loop that is executed N times")
In that way, the "source" is a writing shorthand but one that still
completely constrains the implementation.
E.g., I use a construct:
object=>method(arguments)
liberally in my code. The language doesn't support it (of course).
But, it is known to be a representational shorthand -- something to
unclutter the code and highlight the actual operation being performed.
There is no surprise when you look at the preprocessor output...
for ANY instance of such an expression.
Even the optimizing IDL compiler is obvious in the "optimizations"
that it makes (e.g., choosing effective marshalling sequences instead
of leaving that up to the developer)
After all, the role of a computer language is to convey the developer's
intentions to the hardware in an unambiguous manner. ADDING ambiguity
to that process is counterproductive.
Technical Details
Message-ID:
<11d2msa$3dn7v$3@dont-email.me>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11bp6d1$16i93$1@dont-email.me> <a8n6elh26hc5cg98pn84idqp7rrel2l47o@4ax.com> <11bvnp8$3ehgg$1@dont-email.me> <11c0065$3hr4g$1@dont-email.me> <39e9elp8cqum5iatg21ltbf06hc4p4dgec@4ax.com> <eig9ellto4nl35n0cd8elct4boi2018mcp@4ax.com> <11ck9s9$2dmvp$1@dont-email.me> <fe8selhl8um5p168shk979cms2elurlhh1@4ax.com> <11cma06$34o3u$2@dont-email.me> <4rbtelp38pp2qnaqha6cq7csbfafpgk9i9@4ax.com> <11cmffm$36ee0$1@dont-email.me> <11cqieb$3h7vq$2@paganini.bofh.team> <11cqnt0$mtaq$1@dont-email.me> <11ctd4b$3rem1$1@paganini.bofh.team>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Don Y <blockedofcourse@foo.invalid> Newsgroups: sci.electronics.design Subject: Re: Arms race Date: Wed, 11 Nov 2026 14:31:55 -0700 Organization: A noiseless patient Spider Lines: 77 Message-ID: <11d2msa$3dn7v$3@dont-email.me> References: <11bp6d1$16i93$1@dont-email.me> <a8n6elh26hc5cg98pn84idqp7rrel2l47o@4ax.com> <11bvnp8$3ehgg$1@dont-email.me> <11c0065$3hr4g$1@dont-email.me> <39e9elp8cqum5iatg21ltbf06hc4p4dgec@4ax.com> <eig9ellto4nl35n0cd8elct4boi2018mcp@4ax.com> <11ck9s9$2dmvp$1@dont-email.me> <fe8selhl8um5p168shk979cms2elurlhh1@4ax.com> <11cma06$34o3u$2@dont-email.me> <4rbtelp38pp2qnaqha6cq7csbfafpgk9i9@4ax.com> <11cmffm$36ee0$1@dont-email.me> <11cqieb$3h7vq$2@paganini.bofh.team> <11cqnt0$mtaq$1@dont-email.me> <11ctd4b$3rem1$1@paganini.bofh.team> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 11 Nov 2026 21:31:55 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3595519"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+As6P+85DLbf8aOhZw3lbd"; posting-host="848637c452ff517bbbfb20de77f5863b" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:BWpLAhiiMXxL4+oEDf31XBoxF/8= sha256:W/BJHgp39nzNjgViXVIlDFzyLjwuy2B2vcOMuvkE7AA= sha1:GZs5h0K5Q+kCSQ7zKnucui3Dbc4= sha256:FCEm9e/cwgUrXSLx/Hui+EsWvEYw4Os2Xk05/tJJNc4= Content-Language: en-US In-Reply-To: <11ctd4b$3rem1$1@paganini.bofh.team>