const, volatile, etc [was Re: #defines with parameters]

Guy Harris guy at auspex.UUCP
Tue Dec 20 04:32:18 AEST 1988


>    No, that's not what he meant:  he meant that your definitions of
>    "correct" and "incorrect" are historically wrong,
>
>As somebody else has remarked to you, in the classic era of C, long since
>dead, it was *unthinkable* that the compiler would be much more than a clever
>translator.

Err, umm, I think Henry was around in the classic era of C; so was I,
and so, I suspect, was Doug Gwyn.  It was never obvious to me that it
was "unthinkable", even if compilers at the time may not have done it
(although I know the VAX PCC's "c2" optimizer would do optimizations
like that - or, at least, the S3-vintage one in 4.xBSD, and I seem to
remember somebody, either Doug Gwyn or Henry Spencer, saying that the
Ritchie compiler would do so as well).

>Register, +=, ++, are all sure signs that C was meant to be compiled by
>a simple compiler that relied on the programmer to use such constructs
>to help code generation.

Err, umm, I seem to remember that "+=" was also present in Algol 68;
does that mean that it was also meant to be compiled by "a simple
compiler...."

>    implemented, and used.
>
>On PCs, on PCs...

And UNIX systems.  Did you not read the article posted by Doug Gwyn in
which he stated

	Wrong.  Even Ritchie's PDP-11 C compiler would occasionally do things
	when the peephole optimizer was enabled that caused trouble in device
	drivers, etc.  This was not generally considered a bug; one merely
	revised the code to outwit the optimizer or else turned off the
	optimizer.  Many of these problems could have been circumvented through
	the use of "volatile", if it had existed.

or did you simply choose to pretend he didn't say this?



More information about the Comp.lang.c mailing list