Path: utzoo!attcan!uunet!mcsun!ukc!cam-cl!am From: am@cl.cam.ac.uk (Alan Mycroft) Newsgroups: comp.std.c Subject: Re: (volatile) foo Message-ID: <903@scaup.cl.cam.ac.uk> Date: 21 Sep 89 10:12:52 GMT References: <1989Sep17.180722.21889@light.uucp> Sender: news@cl.cam.ac.uk Reply-To: am@cl.cam.ac.uk (Alan Mycroft) Organization: U of Cambridge Comp Lab, UK Lines: 10 In article <1989Sep17.180722.21889@light.uucp> bvs@light.UUCP (Bakul Shah) writes: >Is the following legal? > char * foo; > while ((volatile)foo) continue; > Sadly, it is legal, although it has a different effect from what many uninitiates would expect. It loads foo as a non-volatile variable then casts it to an int (volatile is ignored except on lvalues which casts are not). Perhaps good compilers would give warnings for such....