No segfault -> null == ""

BCS ao at pathlink.com
Tue Mar 31 12:11:06 PDT 2009


Reply to Sergey,

> Tue, 31 Mar 2009 16:29:30 +0200, Qian Xu wrote:
> 
>> assert(null == "", "null is empty"); // No segfault
>
> When you compare null to an array, null is first converted into an
> empty array, then a comparison takes place.  This happens because
> arguments to comparison operator are first converted to a common type.
> 

FWIW while that may be logically correct, I don't think that's how it actually 
gets implemented.




More information about the Digitalmars-d-learn mailing list