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 31,630 of 33,346   
   =?ISO-8859-15?Q?Daniel_Kr=FCgler?= to All   
   Re: Fun with compile-time binary literal   
   07 Nov 11 00:58:44   
   
   From: daniel.kruegler@googlemail.com   
      
   Am 05.11.2011 00:43, schrieb Gennaro Prota:   
   > On Thu, 03 Nov 2011 19:12:52 +0100, Daniel Krügler   
   >  wrote:   
   >   
   >> Since gcc 4.7 has recently implemented user-defined literals, it is now   
   >> finally possible to define a binary literal operator template that   
   >> behaves very much like built-in literals.   
   >   
   > "Finally possible"? Apart from fun, what is the real-word need   
   > for this stuff?   
      
   It probably depends much on the kind of programming, that you are doing.   
   But I must say that I really had missed the fact that C++ does not allow   
   me to express integral constants in binary notation directly in one or   
   the other occasion.   
      
   I hope, I'm not getting a reply to this question of the kind: "Of-course   
   you can, just write a template and ask programmers to write:"   
      
   unsigned i = _b<0, 1, 0, 0>::value;   
      
   This is not something, that looks like intuitive code to me, compared to   
   the built-in capabilitis of the language as in   
      
   unsigned i = 0xff00U;   
      
   > Isn't it yet another "creative" effort on the committee's part?   
      
   I really do not understandand this part of your question. What has the   
   C++(?) committee to do with my example code?   
      
   Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
         [ 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