Path: utzoo!attcan!uunet!peregrine!elroy!ames!mailrus!uflorida!gatech!bbn!spdcc!ima!compilers-sender From: henry@zoo.toronto.edu (Henry Spencer) Newsgroups: comp.compilers Subject: Re: Optimizations and Language Definitions Message-ID: <2686@ima.ima.isc.com> Date: 22 Sep 88 09:22:31 GMT Sender: compilers-sender@ima.ima.isc.com Reply-To: Henry SpencerLines: 34 Approved: compilers@ima.UUCP In article <2671@ima.ima.isc.com> our moderator writes: >[No, pragmas aren't supposed to change the semantics of code... A common misunderstanding. In fact, the last two drafts have not clearly specified whether they are allowed to or not. Neither interpretation is self-contradictory. The most common argument against is that one is not supposed to interpret one paragraph of a standard without considering the rest, and therefore #pragma is bounded by the rest of the standard. The counter-argument is that the same reasoning applies in reverse: one cannot understand the rest of the standard without considering that that one little paragraph about #pragma may have the power to change it all. There was some sentiment for resolving this ambiguity, but I don't know whether anything will be done now (nothing was done in the May draft). >... since floating point operations are not in general >associative the "as if" rule would rule out rearranging such operations >except in the rare case where the compiler can prove that the results are >the same... This indeed appears to be the case. The sloppy old C wording about how the compiler is free to rearrange is pretty much gone, replaced by the "as if" clause. But the "as if" clause is more restrictive, since it seldom applies to floating point, and in general doesn't even apply to integers (although in fact the only real problem with integers is the occurrence of overflow, and an implementation which ignores overflow can rearrange integer expressions to its heart's content). Henry Spencer at U of Toronto Zoology uunet!attcan!utzoo!henry henry@zoo.toronto.edu -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { decvax | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request