why is string not implicit convertable to const(char*) ?

Wouter Verhelst wouter at grep.be
Fri Jul 6 11:56:36 PDT 2012


Timon Gehr <timon.gehr at gmx.ch> writes:
> This incurs the cost of determining the original string's length,

There are ways to know the original string's length without having to
calculate it. E.g., if you do a read() with some length and you don't
get an error message indicating that there aren't as many characters
available, you can be pretty sure of the string's length. If the
"original" string is a string you read in from a file, there'll be no
need to count characters.

Anyway, this is all besides the point. I think it's safe to say we agree
that bounded strings and arrays are superior to zero-terminated
strings (at least in all but a few corner cases). However, I also happen
to think that saying "zero-terminated strings were a horrendous design
decision" is a bit short-sighted.

That's all.

-- 
The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a


More information about the Digitalmars-d-learn mailing list