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,662 of 33,346   
   Gennaro Prota to daniel.kruegler@googlemail.com   
   Re: Fun with compile-time binary literal   
   11 Nov 11 05:23:57   
   
   From: clcppm-poster@this.is.invalid   
      
   On Mon, 07 Nov 2011 09:58:44 +0100, Daniel Kr=FCgler  =   
      
    wrote:   
      
   > Am 05.11.2011 00:43, schrieb Gennaro Prota:   
   >> On Thu, 03 Nov 2011 19:12:52 +0100, Daniel Kr=FCgler   
   >>  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 doin=   
   g.   
   > But I must say that I really had missed the fact that C++ does not all=   
   ow   
   > 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-cour=   
   se   
   > 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?   
      
   Sorry, both "this stuff" and the subsequent comment were   
   referred to user-defined literals, in general, and not to your   
   code.   
      
   The feature is IMHO a premature generalization effort. And at   
   the end of the day binary literals aren't even there: you just   
   have a way to implement your own (there's nothing in the library   
   either, AFAICS).   
      
   That being said, I'm not going to convince anyone. And there   
   have been worse examples since C++03 (starting probably with   
   strings and I/O library).   
      
   Incidentally, last time I checked (very long ago) UDLs were   
   incompatible with C99's hexadecimal floating constants.   
      
   -- =   
      
      Gennaro Prota         |           name.surname gmail.com   
        Breeze C++ (preview):    
        Do you need expertise in C++?   I'm available.   
      
      
   --   
         [ 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