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

Jonathan M Davis jmdavisProg at gmx.com
Thu Jul 5 19:04:24 PDT 2012


On Thursday, July 05, 2012 19:59:26 Wouter Verhelst wrote:
> Well, really, strings in C are just a special case of arrays (as is true
> in D as well), and arrays in C are just a special case of pointers
> (which isn't true in D). That means the language is fairly compact,
> which also means the compiler has much lower resource
> requirements. I think that, much more than any requirements at runtime,
> has driven the choice for zero-terminated strings.
> 
> Just for comparison, what happens to DMD's memory usage when you do
> extensive templating wouldn't have been possible back in 1969 ;-)

There are a number of things that we do now with programming languages that 
you couldn't do when C was created. Having arrays that know their length is 
not one of them. Other languages in that time frame did it. C made the 
horrendous mistake of not doing it.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list