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 32,627 of 33,346   
   Zeljko Vrba to daniel.kruegler@googlemail.com   
   Re: Useful applications for boolean incr   
   02 Nov 12 11:26:13   
   
   From: mordor.nospam@fly.srk.fer.hr   
      
   On 2012-11-01, Daniel Krügler  wrote:   
   >   
   >> Also, given that boolean ++ is in there, why deprecate   
   >> and / or remove it?  Boolean ++, as it stands, doesn't   
   >> really makes sense to me, and I don't use it, but what's   
   >> the harm?  Is the goal to break templates that use ++ and   
   >> might act unexpectedly with bool?  (But why would not the   
   >> same argument apply to templates that use +=?)   
   >   
   > That is more or less the reason, yes. The participation of bool values   
   > in arithmetic is often cause of unintended code with unexpected outcome.   
   >   
   So, C++98 blew the (only) chance to define bool properly, i.e., as a   
   non-arithmetic type.  Can anybody elaborate on how and why did we end   
   up with a useless arithmetic type?   
      
   (NB! I'm not saying that _boolean type_ [which C++ doesn't have] is   
   useless. I'm saying that _arithmetical type_ restricted to set {0,1}   
   [bool in C++] is useless.)   
      
   (I dare to speculate that far more C programs *were* broken by not   
   allowing implicit conversions from void* than that *would be* broken   
   by disallowing arithmetic on bool.)   
      
      
   --   
         [ 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