From owner-cvs-all Tue Jan 12 05:33:17 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA18851 for cvs-all-outgoing; Tue, 12 Jan 1999 05:33:17 -0800 (PST) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from ns1.yes.no (ns1.yes.no [195.204.136.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA18841; Tue, 12 Jan 1999 05:33:06 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.9.1a/8.9.1) with ESMTP id OAA29678; Tue, 12 Jan 1999 14:32:26 +0100 (CET) Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id OAA66543; Tue, 12 Jan 1999 14:32:26 +0100 (MET) Date: Tue, 12 Jan 1999 14:32:25 +0100 From: Eivind Eklund To: Mark Murray 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> References: <199901120136.RAA01250@freefall.freebsd.org> <19990112111156.I40114@bitbox.follo.net> <199901121313.PAA09349@greenpeace.grondar.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i In-Reply-To: <199901121313.PAA09349@greenpeace.grondar.za>; from Mark Murray on Tue, Jan 12, 1999 at 03:13:35PM +0200 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk 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