Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!uflorida!travis!tom From: tom@ssd.csd.harris.com (Tom Horsley) Newsgroups: comp.lang.perl Subject: Re: VOLATILE in cmd.c Message-ID: Date: 22 May 91 11:16:38 GMT References: <51b2fae2.20b6d@apollo.HP.COM> Sender: news@travis.csd.harris.com Organization: Harris Computer Systems Division Lines: 33 In-reply-to: vinoski@apollo.HP.COM's message of 21 May 91 18:11:00 GMT >>>>> Regarding VOLATILE in cmd.c; vinoski@apollo.HP.COM (Stephen Vinoski) adds: vinoski> Can someone enlighten me? I personally think our compiler is right vinoski> for barking about this strange usage of the "volatile" specifier. If you are doing setjmp/longjmp type processing within the routine and there is a chance the parameter might be kept in a register (as it very well might be, especially on a RISC machine where it got passed in one) then the volatile nonsense is required (actually, an additional requirement is that uses of the parameter must be reachable from the code following the setjmp). Personally, I wish that the ANSI C committee had mandated compiler support for setjmp(). If optimizing compilers were required to recognize setjmp() as a possible target of a non-local goto which might happen from "inside" any other function call, then they could get the data flow analysis and lifetime information correct, and volatile could be restricted to its proper usage - dealing with variables modified in signal handlers and shared memory. (Better yet, they could have added real exception handling to C and dropped setjmp/longjmp, but that's a real can of worms). If your compiler ignores volatile on function parameters, and there is any chance it will keep the parameter in a register, then your compiler may be broken (although it might be hard to contrive an example which would demonstrate it was broken). -- ====================================================================== domain: tahorsley@csd.harris.com USMail: Tom Horsley uucp: ...!uunet!hcx1!tahorsley 511 Kingbird Circle Delray Beach, FL 33444 +==== Censorship is the only form of Obscenity ======================+ | (Wait, I forgot government tobacco subsidies...) | +====================================================================+