DMD 1.032 and 2.016 releases

Tomas Lindquist Olsen tomas at famolsen.dk
Thu Jul 10 13:09:40 PDT 2008


Koroskin Denis wrote:
> On Thu, 10 Jul 2008 22:58:19 +0400, Nick Sabalausky <a at a.a> wrote:
> 
>> "Koroskin Denis" <2korden at gmail.com> wrote in message
>> news:op.ud24ipehenyajd at proton.creatstudio.intranet...
>>> On Thu, 10 Jul 2008 02:56:29 +0400, Walter Bright
>>> <newshound1 at digitalmars.com> wrote:
>>>
>>>> Sean Kelly wrote:
>>>>> Clearly this function isn't valid for all types if T can't be a static
>>>>> array type.
>>>>
>>>> Right.
>>>>
>>>> Andrei has also pointed out that this lack of consistency is a problem
>>>> and should be fixed, but at the moment, that's the way it is.
>>>
>>> The same goes for Tuple. Honestly, I don't see a reason why tuples can't
>>> be returned.
>>> And since Tuple!(char,char,char,char) is no different from char[4],
>>> I think that static arrays should also be allowed as a return type.
>>
>> The problem with returning static arrays is that they live on the stack.
>> Function goes out of scope, bye bye array. Or are you suggesting that the
>> static array be automatically .dup()ed?
>>
>>
> 
> I expect that a bitwise copy returned. Just like with structs.
> What's the difference between char[2] and struct { char[2]; }?

The former is passed (to a function) by reference, the latter by value. Having a type that's 
passed by ref, but return by val, seems inconsistent.

Wasn't there plans to make static arrays value types? is this already so?

Tomas


More information about the Digitalmars-d-announce mailing list