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,276 of 33,346    |
|    Johannes Schaub to All    |
|    Re: Constructor-like initialization of p    |
|    10 May 12 16:19:29    |
   
   883f14a1   
   From: schaub.johannes@googlemail.com   
      
   Am 10.05.2012 23:26, schrieb William Lee:   
   { quoted mod comment snipped -mod }   
   >   
   > In C++ some primitives can be initialized using constructor-like syntax,   
   > like   
   >   
   > int x = int(); // will zero-initialize x   
   >   
   > However, for primitives with multi-word types, I see different behavior   
   > depending on the compiler. For example:   
   >   
   > long long ll = long long();   
   > unsigned int ui = unsigned int();   
   >   
      
   This doesn't work because a the "type()" thing is only allowed when   
   "type" has the form of a "simple-type-specifier", wich is basically "one   
   name" / "one keyword" specifying a type. It's a syntax error. The   
   compiler that accepts it without a warning is nonconforming.   
      
   You can work it around by using some kind of "identity" template as in   
      
    template
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca