Comment # 10 on bug 91 from
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
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 :)


You are receiving this mail because: