Date: Tue, 12 Jan 1999 14:32:25 +0100 From: Eivind Eklund <eivind@FreeBSD.ORG> To: Mark Murray <mark@grondar.za> Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/pci ide_pci.c Message-ID: <19990112143225.C65459@bitbox.follo.net> In-Reply-To: <199901121313.PAA09349@greenpeace.grondar.za>; from Mark Murray on Tue, Jan 12, 1999 at 03:13:35PM %2B0200 References: <199901120136.RAA01250@freefall.freebsd.org> <Pine.BSF.3.95.990111224747.859A-100000@current1.whistle.com> <19990112111156.I40114@bitbox.follo.net> <199901121313.PAA09349@greenpeace.grondar.za>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 12, 1999 at 03:13:35PM +0200, Mark Murray wrote: > On a matter of style, what is the canonical method of fixing "foo may be > clobbered by longjmp" warnings? Correct use of volatile. Unfortunately, volatile has the same somewhat counter-intuitive syntax as const, so most people get it wrong. volatile and const bind to the _left_, unless they're at the leftmost position in an expression, in which case they bind to the right. This does NOT eliminate the warning, as it does not fix the problem: volatile char *data = char volatile *data = pointer to a volatile char This is the correct way to eliminate the problem. the char* is the local variable - and that is what we want to protect: char * volatile data = volatile pointer to a char This is a more esoteric example, just to show how it works: const char * volatile data = char const * volatile data = volatile pointer to a const char. Eivind. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990112143225.C65459>