[Issue 821] segfault with char array copy; mistaken samples in doc
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 10 16:33:28 PST 2007
http://d.puremagic.com/issues/show_bug.cgi?id=821
------- Comment #5 from ch at lathspell.de 2007-01-10 18:33 -------
Hello
Do you consider this a bug in the Linux compiler or just one in the
documentation?
As it is possible to modify a string made out of character constants like
char[] s3 = ['H', 'e', 'l', 'l', 'o'];
but not
char[] s3 = "Hello";
I would argue that this is a bug.
The language description on http://www.digitalmars.com/d/arrays.html does not
mention the existance of "read-only" arrays neither. If they was supposed to
exists there should be at least a boolean .readonly attribute so that functions
that accepts char[] and even check their length can decide if they may or may
not be able to modify the provided char[] buffer.
So at least document this in the language reference, too, as the easy string
handling through arrays with builtin length attribute will surely be one of the
things C programmers attracts...
bye,
-christian-
bye,
-christian-
--
More information about the Digitalmars-d-bugs
mailing list