How to use sprintf

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 25 10:42:45 PDT 2011


On Mon, 25 Apr 2011 13:40:30 -0400, Daniel Gibson <metalcaedes at gmail.com>  
wrote:

> Am 25.04.2011 19:30, schrieb bearophile:
>> Daniel Gibson:
>>
>>> So why not just leave it the way it is?
>>
>> It muds the semantic of the language, adding another special case. I  
>> think the right (right = shared with other structs) semantics here is  
>> to return the address of the length field.
>>
>
> No. Casting other structs (*not* pointer to struct) is in fact illegal.
> (This just occured to me, I didn't think of this when writing the other
> post)
> If you want the address of the struct you write void *foo =  
> cast(void*)&s;
> So the only sane thing to do is either to forbid casting an array to a
> pointer or to return .ptr like it's done now.
> I don't see the harm in the latter, but then again arr.ptr is shorter
> and more readable.
>
> So my only remaining objection is: Allowing it doesn't hurt (IMHO) and
> disallowing may break existing code, so why bother ;)

simpler language spec/compiler :)

-Steve


More information about the Digitalmars-d mailing list