On 18/04/2012 23:44, Robert Adsett wrote: > > On 4/18/2012 5:18 PM, bayramdavies wrote: > > I am still grappling with my "definitive" description of volatile, > > which I hope to submit for review, but there is also work to do for > > which I actually hope to get paid, so it's not ready yet. > > How about > > ----- > volatile controls access to a variable. Reads and writes to a volatile > variable must be performed by the compiler in the order written and > exactly as many times as written. > ----- > > I think that's accurate, complete and deceptively simple. All our other > understandings of its use come from that definition. A formal > definition would include more formal definitions but this is a little > simpler to read if not quite as accurate. It does ignore sequence points > and reordering within an expression, but if you are concerned about the > latter you are probably making your code too complex. > > Note that this means that > > const volatile int *f; > > is not only syntactically correct but useful. And yes, I have used it. > > Robert > > Oh my found an on-line version of cdecl http://cdecl.org/ > > Try > > explain const volatile int *f > > if you have trouble parsing the above declaration > > -- > From the Divided by a Common Language File (Edited to protect the guilty) > ME - "I'd like to get Price and delivery for connector Part # XXXXX" > Dist./Rep - "$X.XX Lead time 37 days" > ME - "Anything we can do about lead time? 37 days seems a bit high." > Dist./Rep - "that is the lead time given because our stock is live.... > we currently have stock." > > Robert, Excellent. Steven. -- *Steven Holder* s.holder123@btinternet.com /www.sh-tec.co.uk/ // [Non-text portions of this message have been removed]
Message
Re: [AVR-Chat] Re: Volatile modifier
2012-04-18 by Steven Holder
Attachments
- No local attachments were found for this message.