[Bug 91] String literals not always properly zero-terminated
d.gnu at puremagic.com
Mon Oct 27 16:25:15 PDT 2014
--- Comment #10 from Peter Remmers <p.remmers at arcor.de> ---
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: http://comments.gmane.org/gmane.comp.lang.d.general/97793
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
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
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 :)
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the D.gnu