-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, Mar 21, 2008 at 03:07:52PM -0700, Bob Blick wrote: > > On Fri, 21 Mar 2008 23:59:36 +0000 (GMT), "sergio masci" > said: > > > > Also I think volatile declarations work the other way around and will > > > not protect you from having to use a shadow register for the type of use > > > you are putting it to. > > > > I would disagree. The way I understand "volatile" to work is that the > > value of a variable may change so don't optimise it. > > > > When the change can occure is undefined. Therefore I would argue that > > using it as a temporary location (as is being used here) is a violation. > > Interesting. I had thought that protection that way is not guaranteed, > all that volatile did was prevent the compiler from assuming the > variable has not changed simply because no nearby code changes it, so > something like this: > > x = 0; > while (x); > > wouldn't get optimized out. > > But I want to hear what Walter says. I think Sergio's point is pretty good; I can't think of an example where an access to a volitile variable would be required without it's ever changing value screwing up the result. In the context of embedded programming, or maybe even any programming, I can't think of a case where such behavior would be useful as well. - -- peter[:-1]@petertodd.org http://petertodd.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH5cn03bMhDbI9xWQRAtsaAKCXPROqUbBLzwhPhtYQN6AcXz4RsQCgk9dY 6mOVFBK0Dk7vc5LW7YFuwKY= =rIM0 -----END PGP SIGNATURE----- -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist