if(arr) now a warning
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 23 05:18:46 PDT 2015
On 4/22/15 6:10 PM, Martin Nowak wrote:
> Interesting trivia, I even found this bug in the documentation of the
> first dmd release http://downloads.dlang.org/releases/0.x/0.100/dmd.100.zip.
>
>
> Checking For Empty Strings
>
> C++ strings use a function to determine if a string is empty:
> string str;
> if (str.empty())
> // string is empty
> In D, an empty string is just null:
> char[] str;
> if (!str)
> // string is empty
>
>
> Apparently it was later fixed to if (!str.length)
> http://www.digitalmars.com/d/1.0/cppstrings.html.
>
Ahh, if only we could go back in time and force Walter to fix the
compiler instead of the docs ;)
-Steve
More information about the Digitalmars-d
mailing list