<span style>>> P.S. Please don't top-post. It's bad etiquette and makes posts harder to follow.</span> <br><br><div>It's not me. It's how gmail works.<br><br><div class="gmail_quote">On Tue, May 15, 2012 at 12:12 AM, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com" target="_blank">jmdavisProg@gmx.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Monday, May 14, 2012 21:16:21 Gor Gyolchanyan wrote:<br>
> At least we could make an empty string a null array of characters for<br>
> consistency.<br>
<br>
</div>It's completely consintent. If there is memory allocated for the array, then<br>
it's ptr property is non-null, and then the array is non-null per the is<br>
operator. If there is no memory allocated for the array, then it's ptr<br>
property is null, and the array is null per the is operator.<br>
<br>
It's quite possible to have non-string arrays be non-null with a length of 0.<br>
It just takes more work. e.g.<br>
<br>
auto a = new int[](1);<br>
a.length = 0;<br>
<br>
And it would actually be really annoying if "" were treated the same as [],<br>
because it becomes harder to differentiate between the empty string and a null<br>
string in the few cases where you care. If anything, the fact that [] doesn't<br>
allocate is _more_ annoying as far as that goes. But it's more efficient that<br>
way, so that's why [] is null.<br>
<div class="im"><br>
> How many times did anyone use the feature of string literals<br>
> being null-terminated?<br>
<br>
</div>It gets used all the time when people call C functions and is a _really_ good<br>
reason why making assert("" is null) true would be a _really_ bad idea.<br>
<span class="HOEnZb"><font color="#888888"><br>
- Jonathan M Davis<br>
</font></span><br>
<br>
P.S. Please don't top-post. It's bad etiquette and makes posts harder to follow.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>
</div>