const, volatile, etc [was Re: #defines with parameters]
Piercarlo Grandi
pcg at aber-cs.UUCP
Sun Dec 18 04:34:54 AEST 1988
In article <1988Dec15.005828.1874 at utzoo.uucp> henry at utzoo.uucp (Henry
Spencer) writes:
>You mean that nobody explicitly stated the obvious rule that an
optimizer >shall not turn a correct program into in incorrect one? ...
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. Also, AT&T C compilers *did* define for a long time what C was...
After all, the Ritchie PDP-11 compiler was known as the "Standard C Compiler"
for some reason, wasn't it?
Now, we all agree that language definitions *should not* depend on particular
implementations, and in clarifying many issues X3J11 has considerably
improved matters on this, but here we are discussing history and rationales.
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.
and do not correspond to the way C was defined,
Just a moment. Ritchie never explicitly did allow aggressive optimization.
So, at the very least, your argument that it was allowed by default, and my
own that it was disallowed by default, are matters of opinion.
But, but I support my opinion by argument, as always. Ritchie introduced
"register" in Classic C, not "volatile", after all, and this *means*
something. If he had meant aggressive optimization to be allowed, he might
not have introduced "register"; he would have surely deemed "volatile"
absolutely necessary, the more so as he used C to write, of all things,
Unix's device drivers.
implemented, and used.
On PCs, on PCs...
Might one ask how long you have been using C, Mr. Grandi?
Regularly, since 1980 (of course I had already bought K&R as soon as it was
out). Probably my main impulse in extolling the virtues of Classic C is
therefore plain old nostalgia for the good ol' days of V7 Unix and C... (on a
Onyx with V7, or an 11/34 with 2.9BSD).
I still keep in my office a photograph of the 11/34 (248KB, 80MB disk, I used
to have five concurrent users with good performance).
--
Piercarlo "Peter" Grandi INET: pcg at cs.aber.ac.uk
Sw.Eng. Group, Dept. of Computer Science UUCP: ...!mcvax!ukc!aber-cs!pcg
UCW, Penglais, Aberystwyth, WALES SY23 3BZ (UK)
More information about the Comp.lang.c
mailing list