How to use sprintf

Steven Schveighoffer schveiguy at yahoo.com
Tue Apr 26 04:59:39 PDT 2011


On Tue, 26 Apr 2011 06:31:39 -0400, Alexander <aldem+dmars at nk7.net> 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


More information about the Digitalmars-d mailing list