implicit casts with dmd ver 1.0

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Jan 19 07:55:44 PST 2007


Peter Blicharski wrote:
> I'm having trouble with the sample code shipped with dmd Ver 1.0
> During compilation i encounter implicit cast errors (file dhry.d)
> By the way, the the dfl window library code is full of these error, too.
> Isn't the dmd compiler supposed to make a cast from char[] to char*
> without error? Or is it needed to always make an explicit cast?

It was removed in version v0.177 at the request of an overwhelming 
majority of people responding to a proposal to do so (IIRC). It's just 
too bug-prone, especially when interacting with C APIs. (In general, D 
strings aren't null-terminated)

It looks like the sample wasn't updated.

If you're sure you want this conversion to occur, you can use arr.ptr to 
get the pointer. If you want to ensure null-termination you are 
encouraged to use std.string.toStringz though.



More information about the Digitalmars-d mailing list