Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!umd5!brl-adm!brl-smoke!gwyn
From: gwyn@brl-smoke.ARPA (Doug Gwyn )
Newsgroups: comp.lang.c
Subject: Re: volatile: a summary
Message-ID: <8059@brl-smoke.ARPA>
Date: 9 Jun 88 22:10:33 GMT
References: <11837@mimsy.UUCP> <796@l.cc.purdue.edu>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) )
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 13

In article <796@l.cc.purdue.edu> cik@l.cc.purdue.edu (Herman Rubin) writes:
>...  Now it is essential that the computation of
>random() be done at _each_ call.  Volatile beats all of the kludges I
>have seen to accomplish this.
>If some better method than a subroutine call is used for each number,
>the problem is still there, and I know of no better way than to use
>volatile.

Sorry, I didn't follow this.  "volatile" doesn't help (is not needed)
to ensure that the function really is called each time in the iteration.
It also is not needed if you implement your own in-line pseudo-random
number generation algorithm.  The only time it would help would be if
you had an addressible memory location that was really a hardware RNG
register.