home bbs files messages ]

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,849 of 33,346   
   Balog Pal to Zeljko Vrba   
   Re: iostream replacement   
   03 Feb 13 17:16:44   
   
   From: pasa@lib.hu   
      
   On 2/3/2013 3:59 PM, Zeljko Vrba wrote:   
   >>> What iostreams *should* have done was something akin to   
   >>>   
   >>>    cout.print(a).print(modify(b)).print(b).endl();   
   >>   
   >> Here, it's sill unspecified whether evaluating modify(b) will   
   >> precede or follow evaluating b. This graph describes the evaluation   
   >> order:   
   >   
   > I'm not convinced.   
      
   Too bad.   
      
   > 5. At a function return, after the return value is copied into the   
   > calling context.  ...   
      
   That is true but pretty much irrelevant for the case. The issue is not   
   with not having sequence points but the order of having them, that is   
   unspecified.   
      
   > There is a return statement after each print (cout& is returned) so   
   > that calls can be chained.  This constrains evaluation order to   
   > left-to-right.   
      
   That applies only to order of issuing the print() calls. That indeed   
   must happen in that order. It tells nothing about the order of   
   evaluation of the arguments they will take. Beyond that arguments are   
   complete before the call starts. How much before is not told.   
      
   That makes the example bive conforming to do   
   - second (b) then (modify(b)) then the print() calls as listed, or   
   - (modify(b)) then second (b) then the print() calls as listed   
   (and certainly there may many other valid orders).   
      
   >  (For if there weren't a sequence point between chained   
   > calls, what would prevent the compiler from reordering the sequence of   
   > calls to print()?)   
      
   I think you misunderstand what sequence points are about and their   
   actual impact.   
      
      
   --   
         [ 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