Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!cvl!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: volatile Message-ID: <10914@mimsy.UUCP> Date: 4 Apr 88 05:20:51 GMT References: <12578@brl-adm.ARPA> <1988Mar25.172355.348@utzoo.uucp> <18686@think.UUCP> <4217@ihlpf.ATT.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 26 [This article was reported as truncated; if you have seen it before, skip it] -In article <9176@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu -(Lawrence V. Cipriani) writes: -> volatile int customer_changeable_var = 0; -> if (customer_chageable_var != 0) ->[without something like volatile] the compiler would be free to ->optimize out the "impossible" code. In article <18686@think.UUCP> barmar@think.COM (Barry Margolin) writes: -I don't think volatile is necessary for the above example. and in article <4217@ihlpf.ATT.COM> nevin1@ihlpf.ATT.COM (00704a-Liber) writes: -The compiler would *not* be free to optimize out this code!! Because -customer_changeable_var is EXTERNAL to main(), this optimization cannot -occur. lvc is right; barmar and nevin1 are wrong. Remember, compilation need not take place until after everything is linked together. Admittedly there are few (possibly no) compilers which would make this `optimisation' today. I expect this to change in the near future. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris