News for hackers. Stuff that matters.
Re:Three proposals for the C standard WG14 by vyodaiken on Thursday June 21, 2018 @09:55AM (#17365084)
C is not Java.
Re:Three proposals for the C standard WG14 by jcelerier on Thursday June 21, 2018 @10:38AM (#17365548)
... and ? it still targets an abstract machine, defined in the C standard in section 5.1.2.3 (Program execution) : http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
Re:Three proposals for the C standard WG14 by vyodaiken on Thursday June 21, 2018 @12:08PM (#17366397)
It targets the abstract machine, but the dispute here is about what should happen when the program operation goes into territory that the abstract machine does not specify. And C code is EXPECTED to go beyond the territory of the abstract machine.
Re:Three proposals for the C standard WG14 by geofft on Thursday June 21, 2018 @12:44PM (#17366785)
> And C code is EXPECTED to go beyond the territory of the abstract machine.

Passive voice! You expect C code to go beyond the territory of the abstract machine. The authors of the standard, quite clearly, do not.

I can see both of these arguments. I think there is a place in the world for a C that is machine-specific. But it's clearly not what the standard authors have in mind, there are clearly people who find the genericness of C useful (cf. "portable assembler"), and piecemeal solutions like skipping individual bad optimizations won't solve the underlying problem that there's no way in C to say "Dude, I'm writing for a reasonable UNIX on a reasonable modern machine with a single flat address space for code and data and non-exception-raising two's-complement arithmetic and the ability to do nonaligned reads/writes and other normal things, please stop thinking I might also be writing for a PDP-11 bootloader."

I think you should go to the standards committee with a single proposal, which is that C should stop trying to be portable to weird / old architectures (and people who need them can use weird / old compilers, anyway). Among other things, you can now enable certain types of optimizations if the compiler is permitted to assume that arithmetic is two's-complement and nonaligned reads/writes work and so forth.

Re:Three proposals for the C standard WG14 by vyodaiken on Friday June 22, 2018 @01:09AM (#17371498)
>You expect C code to go beyond the territory of the abstract machine. The authors of the standard, quite clearly, do not.

That is 100% wrong.

>Strictly conforming programs are intended to be maximally portable among conforming implementations. Conforming programs may depend upon nonportable features of a conforming implementation.

The whole concept of "undefined behavior" is to cope with the reality that C programs routinely go beyond the bounds of the abstract machine.

Re:Three proposals for the C standard WG14 by cesarb on Thursday June 21, 2018 @02:02PM (#17367683)
> if the compiler is permitted to assume that [...] nonaligned reads/writes work

One of the most popular architectures for "a reasonable UNIX on a reasonable modern machine with a single flat address space for code and data" is the x86, and on it, some nonaligned reads/writes do trap. Certain optimizations can be done only if the compiler is permitted to assume that the data is aligned.

Re:Three proposals for the C standard WG14 by vyodaiken on Friday June 22, 2018 @10:19AM (#17374124)
As usual, this is pure handwaving: " certain optimizations ... "