From: mordor.nospam@fly.srk.fer.hr   
      
   On 2012-03-15, red floyd wrote:   
   >   
   > To be honest, that would probably be bad form, and horrendous to read,   
   > but it's perfectly legal to do so.   
   >   
   Using << for stream output is, IMO, bad form too, and was an extremely   
   bad idea   
   when streams were designed. The notation is severely misleading as it   
   implies   
   sequencing where there is none. I have been bitten numerous times by   
   something   
   looking as innocuous as   
      
   cout << a() << b() << endl;   
      
   but where a and b had some side-effects. This looks like sequencing,   
   but is in   
   actuality a series of function calls with unspecified order of   
   evaluation with   
   no sequence point in between. Bad notation indeed.   
      
   This   
      
   cout , a() , b() , endl;   
      
   looks possibly a bit uglier, but it would ensure proper sequencing.   
      
   [Hmm: would it? Is user-defined comma still a sequence point?]   
      
      
   --   
    [ 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)   
|