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 33,261 of 33,346   
   Seungbeom Kim to K. Frank   
   Re: Is broad use of uniform initializati   
   28 Nov 13 05:22:08   
   
   From: musiphil@bawi.org   
      
   On 2013-11-25 22:26, K. Frank wrote:   
   >   
   > Would you recommend broadly adopting uniform initialization   
   > (in new code that doesn't have legacy style constraints)?   
   >   
   > That is, would you recommend using uniform initialization   
   > for things like:   
   >   
   >    const float PI{3.14159};   
   >    for (unsigned i{3}; i < 10; i += 2)   
   >   
   [...]   
   >   
   > Pros:  Such use of uniform initialization is, well, uniform.   
   >   
   > Cons:  We're so used to seeing things like   
   >   
   >    const float PI = 3.14159;   
   >    for (unsigned i = 3; i < 10; i += 2)   
   >   
   > that the uniform initialization syntax becomes distracting.   
      
   Despite the "uniform" initialization syntax adopted into C++11,   
   I expect that the other "old" forms will never go away entirely   
   and that the world of initialization will never be "uniform".   
      
   We realize that the constructor form (now considered old enough) can   
   be more efficient than the copy initialization and is never worse,   
   but the majority of people still write "int i = 0;". And there are   
   times when the other form is still required, e.g. "std::vector v(sz);".   
      
   It's maybe too early to see coding style recommendations established   
   for this matter, but now that we have another option added, my guess   
   is it will make things more diverse, instead of uniform.   
      
   --   
   Seungbeom Kim   
      
      
         [ 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