[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Bitflags
- From: "Bilyk, Alex" <ABilyk@...>
- Date: Tue, 4 Mar 2003 12:21:20 -0800
> -----Original Message-----
> From: Ignacio Castaño [mailto:castanyo@yahoo.es]
> Sent: Tuesday, March 04, 2003 3:37 AM
> To: Multiple recipients of list
> Subject: Re: Bitflags
>
>
> > int myFooFlags = FOO_BLUEPANTS | FOO_3PLANES | FOO_EDIBLE;
>
> And why not:
>
> 'flags = FOO_BLUEPANTS + FOO_3PLANES + FOO_EDIBLE' ?
>
> I don't really see where is the problem here. You can add a
> new bitfield type
> as userdata with ease. Then just overload the '+' and '-'
> operators to act as
> '|' and '-', so that '+' returns a new bitfield and '-'
> returns a boolean.
>
This will result in totally unreadable/misinterpreted code, IMHO. The assumption that '+' can somehow intuitively be realted to '|' is ungrounded to say the least.
Alex