Always false float comparisons

ag0aep6g via Digitalmars-d digitalmars-d at puremagic.com
Thu May 12 10:28:54 PDT 2016


On 05/12/2016 07:12 PM, ag0aep6g wrote:
[...]

tl;dr:

This is surprising to newbies, and a possible source of bugs for 
experienced programmers:

----
writeln("ä".length); /* "2" */
writeln("ä"[0]); /* question mark in a diamond */
----

When people understand the above, they might still not understand this:

----
writeln("length of 'a\u0308': ", "a\u0308".walkLength); /* "length of 
'ä': 2" */
writeln("a\u0308".front); /* "a" */
----


More information about the Digitalmars-d mailing list