Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!nrl-cmf!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: volatile isn't necessary, but it's there Message-ID: <7642@brl-smoke.ARPA> Date: 9 Apr 88 23:26:36 GMT References: <7794@alice.UUCP> <10988@mimsy.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 17 In article <10988@mimsy.UUCP> mangoe@mimsy.umd.edu.UUCP (Charley Wingate) writes: >>Volatile is of use only with optimizing compilers; those that don't >>do some kind of data-flow analysis can ignore it. More bluntly, >>it is intended to be used in cases where your compiler will do something >>other than what your program plainly asks it to do. >These statements only acquire truth because the default understanding of >what the compiler ought to do is very very conservative and tends to reflect >the most simple-minded way of understanding the code. A programmer who is at all concerned with portability will code for a "virtual machine", not for the current accidental hardware. It is extremely important that this virtual machine HAVE simple properties; otherwise it becomes practically impossible to write correct code for it. Matters are somewhat confused in C because its virtual machine has some properties that have deliberately fuzzy specifications; this was intended to permit more efficient realizations of the virtual machine on actual hardware, but it causes trouble when programmers don't clearly understand this issue.