🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #607

Re: (volatile) foo

#607
From: Alan Mycroft
Date: Thu, 21 Sep 1989 10:12
10 lines
826 bytes
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....
Technical Details
Message-ID: <903@scaup.cl.cam.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!cam-cl!am
References: <1989Sep17.180722.21889@light.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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