🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.electronics.design
Article #947

Re: Arms race

#947
From: Don Y
Date: Sun, 08 Nov 2026 21:00
49 lines
4214 bytes
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.

E.g., memcpy() is free to walk past the end of the address space
if the source/destination address -- plus the length -- moves it
to that point.  Or, it could opt to be more reasonable and inhibit
such action.  Either solution is an acceptable behavior -- regardless
of the behavior that you *hoped* would occur.

But, it can't decide to divide every value stored in EVERY memory
location by 3 -- unless the value stored there is a 7 in which case
it replaces it with a 42.  A compiler/library designer wouldn't
deliberately come up with a bizarre action to perform when the required
action isn't clear.  He'll do what seems logical in a normal case,
even if that isn't what the developer intended (developer broke the
contract by trying to do something that wasn't defined; we don't
punish him by killing his first-born...)
> are rarely emited by compilers, but one can get 'return'
> (if compiler decides that garbage source is doing nothing
> useful, but it will eventually finish) or executing whatever
> happens to be after deleted code (if compiler decides that
> code should be never executed because it performed illegal
> operation).

What "illegal operation" -- beyond a SIGSEGV?  The compiler
doesn't prevent me from dividing by zero (though many are
astute enough to notice that and WARN me).  Or, from overwriting
a table of interrupt vectors.  Or, the software itself!

It can *advise* against things that seem likely to be errors
or result in anomalous behaviors.  But, it's the developer who opts
to override those warnings.  No rule says you have to check malloc()'s
return value.  And, /in some cases/, you may be 100% confident that
it is *NOT* NULL.

[That's why folks who don't address every warning are shoddy
developers -- make it explicitly clear to me and the compiler
that you actually WANT this behavior!]
> It is much nicer when you share things that you do know.

Technical Details
Message-ID: <11cqnt0$mtaq$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11bp6d1$16i93$1@dont-email.me> <ado1el51rv6t5e055ospgkmids7krtrd2m@4ax.com> <11bvc3s$3a0ts$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>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!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: Sun, 8 Nov 2026 14:00:12 -0700
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <11cqnt0$mtaq$1@dont-email.me>
References: <11bp6d1$16i93$1@dont-email.me>
 <ado1el51rv6t5e055ospgkmids7krtrd2m@4ax.com> <11bvc3s$3a0ts$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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 08 Nov 2026 21:00:17 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="750938"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19jd6Fu17UhiDZoDYa6rzX7"; posting-host="7cde9eaec8238a20f43c474d7d67e8fa"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:r/0QmMCMiKjkuJhM3qyYuXcH7c0= sha256:xk5FsS5fUCu6QqiCRLFNWSEFKiQh7zEWpmoEXUpAqG8=
	sha1:9GjbJrrYnqH71NesYiZxGAP+/4E= sha256:dSoFYAQBciaFnxopTiVKonmqzsaM/WHFMECgKuWIewA=
Content-Language: en-US
In-Reply-To: <11cqieb$3h7vq$2@paganini.bofh.team>