#define volatile /*empty*/ (was register volatile)

Chris Torek chris at mimsy.UUCP
Fri Jan 6 21:49:39 AEST 1989


>In article <15304 at mimsy.UUCP> I noted
>>For portable code, you must avoid `register volatile', because current
>>systems (not dpANS-conformant, but still useful, such as SunOS) will
>>use something like
>>	#define volatile /*empty*/

In article <9290 at smoke.BRL.MIL> gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>But that's clearly wrong in the first place.  When back-porting to a
>pre-ANSI C environment, all uses of "volatile" (there shouldn't be
>many) have to be carefully checked to determine just why "volatile"
>was necessary, and adjustments made (if possible).  There is no viable
>alternative!

But the only% use for volatile in conformant code, aside from any
hidden under the `sig_atomic_t' typedef, is to protect against setjmp/
longjmp interactions.  Presumably this (that is, using no qualifier at
all) already works in all existing applications that use setjmp, since
there is in fact no alternative at all.
-----
% Well, the only one I can think of.
-----

>P.S.  I do plant the above definition in pre-ANSI C environments

A-*ha*!  :-)

>(although I can't recall using it), but I don't expect it to "do the
>right thing" automatically, because it can't.

*Nothing* can; that is the point: so we use nothing.

(That was a joke.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list