Path: utzoo!mnetor!uunet!pwcmrd!skipnyc!atpal!tneff From: tneff@atpal.UUCP (Tom Neff) Newsgroups: comp.lang.c Subject: Re: Optimization (was Re: volatile) Message-ID: <134@atpal.UUCP> Date: 25 Apr 88 22:48:34 GMT References: <13074@brl-adm.ARPA> <280@fxgrp.UUCP> <895@cresswell.quintus.UUCP> Reply-To: uunet!pwcmrd!skipnyc!atpal!tneff Organization: Rational Technologies, Inc. Lines: 24 Summary: it doesn't In article <895@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes: > ... [volatile] shouldn't be a #pragma because #pragma isn't supposed to >change what anything _means_. I don't see volatile as changing what anything means, except to the optimizer. Forbidding the code generator to cache a variable's contents should have no effect on a program's behavior with 'classic' variables like counters in ordinary RAM. Indeed, in a compiler with full control over optimization, setting a /NOOPTIMIZE switch ought to make volatile effectively a no-op, since the elementary optimization of cacheing values within an expression, for instance, would be turned off and the code would in fact go "to the metal" every time a variable was referenced -- which is all volatile is trying to do. My claim is that volatile essentially says nothing about a program except what's legal for the optimizer to play with -- thus #pragma is appropriate. However I will not kick if it stays a keyword, as I would have with the late unlamented noalias, simply because it would be unnecessary to sprinkle new alien syntax into the familiar library header files -- only those who need it would ever have to see it. -- Tom Neff UUCP: ...uunet!pwcmrd!skipnyc!atpal!tneff "None of your toys CIS: 76556,2536 MCI: TNEFF will function..." GEnie: TOMNEFF BIX: are you kidding?