[TUHS] : C dialects (was: I can't drive 55: "GOTO considered harmful" 55th anniversary)
Steve Nickolas
usotsuki at buric.co
Tue Mar 14 05:17:04 AEST 2023
On Mon, 13 Mar 2023, Clem Cole wrote:
> Frankly, I'd probably rather see ISO drop a bunch of the stuff they are now
> requiring and fall back at least to K&R2 -- keep it simple. The truth is
> that we still use the language today is that K&R2 C was then (and still is)
> good enough and got (gets) the job done extremely well. Overall, I'm not
> sure all the new "features" have added all that much.
C99 did introduce one thing I use: <stdint.h>
Beyond that, I still code strict C89. I simply treat the language itself
as ossified. I also still make assumptions about the compiler that might
not still be true, so for example
unsigned short a;
unsigned char b;
b=0xFF;
a=b<<8;
I expect to return 0 even though the logical answer is 0xFF00, and I
_always_ code it like this:
b=0xFF;
a=b;
a<<=8;
or alternatively
b=0xFF;
a=((unsigned short) b)<<8;
and there's other defensive stuff I do. I honestly don't see the point in
the other changes to the language and feel they take C away from what it
has always been.
-uso.
More information about the TUHS
mailing list