digitalmars.D.learn - String literal converted to char*. Doc bug?
- simendsjo (8/9) Apr 08 2011 But this fails
- Jesse Phililps (3/15) Apr 08 2011 I think the documentation is out of date. Untested:
- simendsjo (1/1) Apr 08 2011 Ok, files bug: http://d.puremagic.com/issues/show_bug.cgi?id=5820
The documentation for array says(...), and a string literal can be implicitly cast to a char*But this fails char* a = "a"; // cannot implicitly convert expression "a" of type string to char* This works: char* a = cast(char*)"a"; Is the documentation a bit out of date, is this a bug, or is it only correct in some cases?
Apr 08 2011
simendsjo Wrote:The documentation for array saysI think the documentation is out of date. Untested: const(char)* a = "a";(...), and a string literal can be implicitly cast to a char*But this fails char* a = "a"; // cannot implicitly convert expression "a" of type string to char* This works: char* a = cast(char*)"a"; Is the documentation a bit out of date, is this a bug, or is it only correct in some cases?
Apr 08 2011
Ok, files bug: http://d.puremagic.com/issues/show_bug.cgi?id=5820
Apr 08 2011