<html>
<head>
<base href="http://bugzilla.gdcproject.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - String literals not always properly zero-terminated"
href="http://bugzilla.gdcproject.org/show_bug.cgi?id=91#c10">Comment # 10</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - String literals not always properly zero-terminated"
href="http://bugzilla.gdcproject.org/show_bug.cgi?id=91">bug 91</a>
from <span class="vcard"><a class="email" href="mailto:p.remmers@arcor.de" title="Peter Remmers <p.remmers@arcor.de>"> <span class="fn">Peter Remmers</span></a>
</span></b>
<pre>The more I read about this topic, the more I notice that D seems to have a long
history of this popping up, dating back to as early as 2005.
For example: <a href="http://comments.gmane.org/gmane.comp.lang.d.general/97793">http://comments.gmane.org/gmane.comp.lang.d.general/97793</a>
The idea of using char* usage as an indicator for C-style strings does not seem
so bad a solution, given the limited possibilities and the consequences of
other solutions that have been explored.
The problem is, this needs to be well-documented. Every (scarce) piece of
current documentation on this says "string literals are 0-terminated". No
further constraints. So I would expect initializing a string variable with a
literal would just copy the pointer and thus make the string also zero
terminated.
Zero termination popping in and out of existence depending upon the usage
context is totally un-obvious, un-intuitive, and right now un-documented.
And it is also a surprising behavior in only one of the three major D
compilers.
The again, just stating that "literals are 0-terminated", and making sure they
always are, is what D currently has settled on. And I wouldn't have noticed any
problems if I hadn't tried GDC :)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are watching all bug changes.</li>
</ul>
</body>
</html>