Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,600 of 33,346    |
|    Ike Naar to Gil N.    |
|    Re: Why is ?volatileQualifiedExpr + vola    |
|    19 Oct 12 22:55:39    |
   
   64f679e9   
   From: ike@sverige.freeshell.org   
      
   On 2012-10-19, Gil N. wrote:   
   > C standard is indeed more terse and when read ad litteram it seems   
   > to allow unsequenced 'volatile access' to non volatile objects.   
   >   
   > however,   
   > "any expression referring to such an object shall be evaluated   
   > strictly according to the rules of the abstract machine, as described   
   > in 5.1.2.3" (6.7.3) - all my quotes are from C standard.   
   >   
   > imagine this:   
   >   
   > {   
   > int a = 0;   
   > int volatile * pa = &a;   
   > int volatile * pb = pa + pa; /*(1)*/   
      
   Addition of pointers is an invalid operation in C and in C++.   
      
   > int b = *pa + *pa; /*(2)*/   
   > }   
   >   
   > remember that evaluation of an expression is value evaluation and   
   > initiation of side effects. in (1) evaluating pa has side effects.   
   > in (2) evaluating '*pa' with effective non volatile type must obey   
   > the rules of abstract machine because it is an evaluation of an   
   > (sub)expression referring to a volatile object 'pa'.   
      
      
   --   
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca