Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!ncar!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.UUCP (Rahul Dhesi) Newsgroups: comp.lang.c Subject: Re: Optimization, volatile (was Re: volatile) Message-ID: <2867@bsu-cs.UUCP> Date: 4 May 88 20:29:38 GMT References: <13074@brl-adm.ARPA> <2003@rtech.UUCP> <503@wsccs.UUCP> <536@sol.warwick.ac.uk> Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi) Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 43 In article <536@sol.warwick.ac.uk> cudcv@cu.warwick.ac.uk (Rob McMahon) writes: <>It's been said before, but some people seem to have missed it ... how do <>you use #pragma to specify all of: <> <> volatile int *p; #pragma volatile int *p <> int *volatile p; #pragma int *volatile p <> volatile int *volatile p; #pragma volatile int *volatile p To decrease redundancy use a place-holder token where it says "int" above: #pragma volatile ? *p #pragma ? *volatile p #pragma volatile ? *volatile p Or, simplest of all, just choose one of these: #pragma volatile *p #pragma volatile p #pragma volatile p, *p P.S. I still think the "volatile" keyword is a better way for specifying volatility than the pragma mechanism, but not because of the argument that I'm refuting. There are two more serious problems with using pragma here, and at least the second one has been mentioned before in this newsgroup: (1) The presence of "volatile" changes the semantics of the hypothetical C virtual machine; (2) Vendors are free to choose any syntax for their #pragma volatile, violating the intuitively-obvious requirement that a universal concept ought to be represented in a universal syntax. Standard Weasel Clause: The validity of argument (1) above depends on the exact meaning of the phrase "semantics of the hypothetical C virtual machine. -- Rahul Dhesi UUCP: !{iuvax,pur-ee,uunet}!bsu-cs!dhesi