[Info-vax] C et al (was: Re: Rust as a HS language, was: Re: Quiet?)

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Mon Apr 11 11:39:20 EDT 2022


On 2022-04-11 13:14:39 +0000, Simon Clubley said:

> On 2022-04-10, Stephen Hoffman <seaohveh at hoffmanlabs.invalid> wrote:
>> On 2022-04-10 02:29:53 +0000, Stephen Hoffman said:
>> 
>>> My usual pointer to just what volatile provides, and doesn't provide:
>>> 
>>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1152r0.html
>> 
>> For those that believe there is but one write with volatile, there's 
>> one write per byte yes, but there can be multiple and arbitrary-ordered 
>> writes involved within that operation.
>> 
> 
> Any compiler doing anything as brain-dead as that would instantly be 
> dropped and if it was an open-source compiler, would instantly be 
> forked, XFree86 style, and the brain-dead additions removed.

That's unclear, as there can be differences between the C abstract 
machine and the physical machine—such as around unaligned memory 
access. q.v. Alpha.

If you can only do one write to a range of bytes per volatile, and if 
the memory address is unaligned, then you can have to do that in 
separate writes with older Alpha.

The older Alpha hardware didn't have the instructions necessary for 
that memory access.

The compiler would preferentially align the memory address, but that's 
not necessarily always possible with machine registers.

In C, the ways of volatile are subtle and quick to anger.

As much as I can and do use C and will continue to use C on OpenVMS and 
elsewhere, I'm also looking forward to access to UBSan and some new 
tooling, and to Clang, to make existing and new C code better.

And I'll continue to look into options and alternatives, including 
Swift. Maybe zig. Albeit that not on OpenVMS.

-- 
Pure Personal Opinion | HoffmanLabs LLC 




More information about the Info-vax mailing list