Can someone please explain why the following assertion fails?

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 1 11:08:09 PDT 2016


On Tuesday, 1 November 2016 at 14:06:08 UTC, Steven Schveighoffer 
wrote:
> On 10/31/16 3:08 PM, Gary Willoughby wrote:
>> Can someone please explain why the following assertion fails?
>>
>> import std.stdio;
>> import std.conv;
>>
>> void main(string[] args)
>> {
>>     auto x = 1;
>>
>>     assert(hashOf(x.to!(string)) == hashOf(x.to!(string)));
>> }
>>
>> Thanks.
>
> IMO, it shouldn't. A string's "value" has nothing to do with 
> it's location.
>
> -Steve

It definitely is surprising. I'll raise an issue and see what 
others think.

https://issues.dlang.org/show_bug.cgi?id=16654


More information about the Digitalmars-d-learn mailing list