Bools reloaded

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Sat Mar 4 03:22:39 PST 2006


Bruno Medeiros wrote:
> Ivan Senji wrote:
> 
>> xs0 wrote:
>>
>>> Even though I don't mind typing something as simple as
>>>
>>> if (a!=null)
>>>
>>> the verbosity of longer expressions really annoys the heck out of me. 
>>> Now, I prefer
>>>
>>>  > if (a && b && c && d) // check for nulls
>>
>>
>> But what is going on behind the scene if a,b,c,d are ints or ponters,
>> conversions to bools? I still don't get it how logic && operator can 
>> be aplied to integers. What is 5 && 3? (Except two numbers: 5,3.) It 
>> has no value regarding truth. It is neither true nor false.
>>
>>
> 
> With the behavior implicit conversion from int to bool, "5 && 3" becomes 
> "true && true".
> 

I know, but I still see 5 && 3 in my code! :)



More information about the Digitalmars-d mailing list