Path: utzoo!attcan!uunet!mcvax!ukc!dcl-cs!aber-cs!pcg From: pcg@aber-cs.UUCP (Piercarlo Grandi) Newsgroups: comp.lang.c Subject: Re: const, volatile, etc [was Re: #defines with parameters] Message-ID: <438@aber-cs.UUCP> Date: 20 Dec 88 07:26:52 GMT Reply-To: pcg@cs.aber.ac.uk (Piercarlo Grandi) Distribution: eunet,world Organization: CS Dept., University College of Wales, Aberystwyth, UK (Disclaimer: my statements are purely personal) Lines: 58 >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; You remember well... does that mean that it was also meant to be compiled by "a simple compiler...." You will also remember as well that they were introduced into the language precisely to offer a cheap opportunity for the compiler to generate good code without too much effort. While Algol68 is a compiler writer's nightmare from a parsing viewpoint (and the support library is not easy to write as well), it was carefully designed not to require complex code generation. The and-becomes operators were one of the neatest ideas, readily borrowed in C. > 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? It so happens that his article has received this site only today, as far as I could see (note that occasionally articles get lost as well). I have already answered him privately, because I'd rather not debate publicly an article so rich in morbid comments (it is me that is using "sleazy ploys"? hey man, watch your ton.. oops keyboard :-) !) and other exercises of style. In any case, I don't see as my duty to address all the funny things certain people say. It will be my pleasure however to address that message as soon as I have time to digest it, because finally it contains some arguments, and they are exactly those I had expected (...leave elegance to tailors :->). As to the matter in the specific paragraph you cite, I thought it was obvious that it supports my arguments. It merely reiterates what is common knowledge, that even PCC peephole optimizers tend to be quite buggy, and in more than one way. What you "generally" consider to be a bug or a feature is your business after all, but word twisting can only go so far. Me, I see this as a further reason to believe that optimizers are often not reliable, and relying on ever more complex ones should not be encouraged, by way of volatile, on purely technical grounds. After all register will work even if you don't use the optimizer, will it? -- Piercarlo "Peter" Grandi INET: pcg@cs.aber.ac.uk Sw.Eng. Group, Dept. of Computer Science UUCP: ...!mcvax!ukc!aber-cs!pcg UCW, Penglais, Aberystwyth, WALES SY23 3BZ (UK)