string, char[], overloaded functions.

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 31 17:05:19 PDT 2014


On Friday, 31 October 2014 at 23:59:54 UTC, dajones wrote:
> So shouldnt char[] implicity convert to string

Nope, char[] casting to string is generally a bad thing that 
should be avoided because it can leave you with a mutable string, 
which isn't supposed to happen.

In your case, why are you using char[] for the buf instead of 
just string?


BTW one could argue that char[] ~ operator should yield something 
that's implicitly convertable, since it allocates a new memory 
block anyway, but that's not how it works right now.


More information about the Digitalmars-d-learn mailing list