Does D has C#'s string.Empty?

AsmMan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 25 17:24:27 PDT 2014


On Thursday, 25 September 2014 at 12:43:57 UTC, Steven
Schveighoffer wrote:
> On 9/25/14 2:41 AM, SlomoTheBrave wrote:
>> On Thursday, 25 September 2014 at 05:29:37 UTC, AsmMan wrote:
>>> Does D has C#'s string.Empty?
>>
>> string.init ?
>>
>> ----
>>     string a;
>>     a = string.init;
>>     assert( a == "");
>> ----
>>
>> does the job for the type string at least.
>>
> null also works. In fact, in the above, a is already 
> string.init or null before assigning (D always initializes 
> variables unless asked not to).
>
> a = null; // same as a = string.init;
>
> -Steve

It made me a bit confusing. How is the implementation of string
comparasion in D? (if someone could point to actual code used in
these comparasion would be really great otherwise I'll check out
assembly output, maybe) in no language I know of (including C#)
"" == null is true


More information about the Digitalmars-d-learn mailing list