Re: [C++] Best Way to ++booleans?
From: Attila Feher (attila.feher_at_lmf.ericsson.se)
Date: 01/28/04
- Previous message: Martijn Lievaart: "Re: [C, C++] "(a=b) = c;" Illegal or Undefined?"
- In reply to: Jumbo: "Re: [C++] Best Way to ++booleans?"
- Next in thread: Jumbo: "Re: [C++] Best Way to ++booleans?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Jan 2004 14:58:48 +0200
> "Chris Newton" <chrisnewton@no.junk.please.btinternet.com> wrote in
> message news:bv6tmb$bm1$1@titan.btinternet.com...
>> James Connell wrote...
>>> thanks Cris! i'm still learning C++, didn't know you could overload
>>> on enums. would that remove the object overhead as well?
>>
>> Yep, good trick, in'it? :-)
>>
>> And yes, it's overhead-free. Manipulating enums like this is really
>> no different to writing a function that works on something like an
>> int, and indeed it's quite likely that under the covers, that's
>> exactly what it'll compile down to.
>>
> Can't you change the type for the enumerator too?
There is a proposal, but in the current language you cannot. In C it is
int, in C++ it is an integral type the compiler comes up with.
-- Attila aka WW
- Previous message: Martijn Lievaart: "Re: [C, C++] "(a=b) = c;" Illegal or Undefined?"
- In reply to: Jumbo: "Re: [C++] Best Way to ++booleans?"
- Next in thread: Jumbo: "Re: [C++] Best Way to ++booleans?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|