Date: Thu, 13 Jan 2000 03:45:47 +0100 (CET) From: Oliver Fromme <olli@dorifer.heim3.tu-clausthal.de> To: freebsd-questions@FreeBSD.ORG Subject: Re: Volatile variables Message-ID: <200001130245.DAA65229@dorifer.heim3.tu-clausthal.de> In-Reply-To: <85jdi6$1paq$1@atlantis.rz.tu-clausthal.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Mikhail Evstiounin <evstiounin@adelphia.net> wrote in list.freebsd-questions: > [...] > Like I told above it should be done in atomic way, but vilotale means - > avoid > optimiozations. "volatile" does not mean that the compiler should not optimize. It only means that the compiler must not make certain assumptions about a variable, and that its value may be read or written asynchronously, i.e. its value might not be consistent between statements. No more, no less. Of course, this inhibits certain types of optimizations, naturally. > And again it's a hint - just a hint. Some aggresive > optimizers > could ignore it. No! A C compiler must not ignore the "volatile" qualifier. It's the compiler's job to make sure that the program is not working with a "stale" variable value. > For example, if commands cli/sti could be used by compiler > and works like it work in 8086, optimizer could do the following: Yeah, it could, but this is UNIX, not DOS. :) Regards Oliver -- Oliver Fromme, Leibnizstr. 18/61, 38678 Clausthal, Germany (Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de) "In jedem Stück Kohle wartet ein Diamant auf seine Geburt" (Terry Pratchett) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001130245.DAA65229>