int opEquals(Object), and other legacy ints

Walter Bright newshound at digitalmars.com
Fri Jul 21 10:13:10 PDT 2006


Bruno Medeiros wrote:
> Walter Bright wrote:
>> Stewart Gordon wrote:
>>> There seem to be a number of leftovers from before we had a bool 
>>> type, and many people were using the int type to pass booleans around.
>>
>> They are typed as returning int for efficiency reasons. These 
>> functions often appear in performance critical loops, where an extra 
>> instruction or two makes a difference.
> 
> But isn't bool an int internally? Why is it less efficient to use a bool?

It's a byte internally, and is constrained to be one of the values 0 or 1.



More information about the Digitalmars-d-bugs mailing list