Re: Can't assign string to char * like the docs say

2009-05-14 Thread Gide Nwawudu
On Wed, 13 May 2009 16:42:51 -0400, "Steven Schveighoffer" wrote: >it is a documentation bug, this behavior is not allowed. Please submit a >bug to bugzilla: http://d.puremagic.com/issues/ > >On the other hand, string *literals* are implicitly castable to char *: > >char *p = "abc"; > >works.

Re: Can't assign string to char * like the docs say

2009-05-13 Thread Jarrett Billingsley
On Wed, May 13, 2009 at 2:28 PM, Doctor J wrote: > Taken straight from http://www.digitalmars.com/d/1.0/arrays.html, this > doesn't compile: > >    void main() >    { >        string str = "abc"; >        char* p = str;          // pointer to 1st element >    } > > "Error: cannot implicitly conve

Re: Can't assign string to char * like the docs say

2009-05-13 Thread Steven Schveighoffer
On Wed, 13 May 2009 14:28:46 -0400, Doctor J wrote: Taken straight from http://www.digitalmars.com/d/1.0/arrays.html, this doesn't compile: void main() { string str = "abc"; char* p = str; // pointer to 1st element } "Error: cannot implicitly convert exp

Re: Can't assign string to char * like the docs say

2009-05-13 Thread Trass3r
Doctor J schrieb: Taken straight from http://www.digitalmars.com/d/1.0/arrays.html, this doesn't compile: void main() { string str = "abc"; char* p = str; // pointer to 1st element } "Error: cannot implicitly convert expression (str) of type char[] to char*

Can't assign string to char * like the docs say

2009-05-13 Thread Doctor J
Taken straight from http://www.digitalmars.com/d/1.0/arrays.html, this doesn't compile: void main() { string str = "abc"; char* p = str; // pointer to 1st element } "Error: cannot implicitly convert expression (str) of type char[] to char*" I agree it should