Path: utzoo!mnetor!uunet!mcvax!diku!dkuug!dde!be From: be@dde.uucp (Bjorn Engsig) Newsgroups: comp.lang.c Subject: Re: A different view of volatile Message-ID: <432@Aragorn.dde.uucp> Date: 6 May 88 08:37:27 GMT References: <13120@brl-adm.ARPA> Organization: Dansk Data Elektronik A/S, Herlev, Denmark Lines: 44 Summary: volatiles changes not only asynchronously In article <13120@brl-adm.ARPA>, christiansen@chewi.che.wisc.EDU (REED CHRISTIANSEN) writes: ... > VOLATILE (that is, whose value(s) can change asynchronously due to > action by another process or by hardware action) ... --------------- --------------- That's not the only cases, consider: ----------------- get_value.c ------------------ static int *pointer; set_address(ptr); int *ptr; { pointer = ptr }; get_value() { /* stuff */ if (value_found) { *pointer = value; return 1; } else return 0; } ------------------ main.c ------------------- main() { /* volatile */ int result; set_address(&result); while (get_value()) process_it(); } Such kind of code is for example found in database host language interfaces, where you first define where to store the data from the database, and later you fetch the data until no more data are found. In real life, the set_address() is called a various number of times (probably many times) and then get_value() knows the addresses and doesn't need a large and varying number of parameters. This is not to oject against volatile, I know where I should put it. -- Bjorn Engsig @ Dansk Data Elektronik A/S, Herlev, Denmark Email: be@dde.dk Phone: + 45 2 84 50 11 Email: ..!uunet!mcvax!dkuug!dde!be Fax: + 45 2 84 52 20