[Vm-dev] suspect test in dabusiness.h
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Fri Aug 31 17:16:12 UTC 2012
2012/8/31 Eliot Miranda <eliot.miranda at gmail.com>:
>
>
>
> On Thu, Aug 30, 2012 at 3:10 PM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
>>
>>
>> strange test in line 73:
>> if (!(size = sizeField(arg)))
>> size = argByteSize = sizeof(void *);
>> else
>> argByteSize = abs(size);
>>
>> for me, it means
>>
>> if (sizeField(arg) != 0)
>> size = argByteSize = sizeof(void *);
>> else
>> size = argByteSize = 0;
>
>
> you have it the wrong way round. It is equivalent to
>
> size = sizeField(arg);
> if (!size)
> size = argByteSize = sizeof(void *);
> else
> argByteSize = abs(size);
>
> which is equivalent to
>
> size = sizeField(arg);
> if (size == 0)
> size = argByteSize = sizeof(void *);
> else
> argByteSize = abs(size);
>
>>
>> is it intentional ?
>
>
Hem, my bad, as most humans, my logic failed at double negation...
if( size ) <=> if (size != 0)
if( ! size ) <=> if (! (size != 0)) <=> if (size == 0)
Eliot, this indicates that you and your code are too clever ;)
Nicolas
> yes.
>
>>
>>
>> Nicolas
>
>
>
>
> --
> best,
> Eliot
>
>
More information about the Vm-dev
mailing list