[Issue 8384] std.conv.to should allow conversion between any pair of string/wstring/dstring/char*/wchar*/dchar*

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 15 13:35:30 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8384



--- Comment #10 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-08-15 13:35:28 PDT ---
char* acts identically to the other pointer types, and I fully believe that it
should stay that way. We've pretty much removed all of the D features which
involved either treating a string as char* or a char* as a string (including
disallowing implicit conversion of string to const char*). The _only_ feature
that the language has which supports that is the fact that string literals have
a null character one past their end and will implicitly convert to const char*.

It would be a huge mistake IMHO to support doing _anything_ with character
pointers which treats them as strings without requiring an explicit conversion
of some kind. Anyone who continues to think of char* as being a string in D is
just asking for trouble. They need to learn to use strings correctly.

If you really want to use char* as a string in functions like format or
writeln, then simply either use to!string or ptr[0 .. strln(ptr)].

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list