On Tue, 26 Apr 2011 06:31:39 -0400, Alexander <[email protected]> wrote:

On 25.04.2011 17:36, Steven Schveighoffer wrote:

Not when a string is defined internally as struct { size_t length; immutable(char)* ptr; }. Casting to char* is a pointer to the start of the length, not the pointer.

Try it.


I thought that "feature" was removed from D2? Just tested it, and it's definitely not removed yet. But it will be :)

How exactly this feature will be removed? Disallowing opCast() which does this explicitly? ;)

Currently, casting an array to a pointer is a special case of casting in the compiler, which basically returns arr.ptr. However, that functionality is already available via arr.ptr.

I think the special case can be disallowed.  opCast will remain as-is.

-Steve

Reply via email to