Does dmd have SSE intrinsics?

Robert Jacques sandford at jhu.edu
Tue Sep 22 17:23:25 PDT 2009


On Tue, 22 Sep 2009 19:06:22 -0400, Christopher Wright  
<dhasenan at gmail.com> wrote:
> Robert Jacques wrote:
>> On Tue, 22 Sep 2009 07:09:09 -0400, bearophile  
>> <bearophileHUGS at lycos.com> wrote:
>>> Robert Jacques:
>> [snip]
>>>> Also, another issue for game/graphic/robotic programmers is the  
>>>> ability to
>>>> return fixed length arrays from functions. Though struct wrappers
>>>> mitigates this.
>>>
>>> Why doesn't D allow to return fixed-sized arrays from functions? It's  
>>> a basic feature that I can find useful in many situations, it looks  
>>> more useful than most of the last features implemented in D2.
>>>
>>> Bye,
>>> bearophile
>>  Well, fixed length arrays are an implicit/explicit pointer to some  
>> (stack/heap) allocated memory. So returning a fixed length array  
>> usually means returning a pointer to now invalid stack memory. Allowing  
>> fixed-length arrays to be returned by value would be nice, but  
>> basically means the compiler is wrapping the array in a struct, which  
>> is easy enough to do yourself. Using wrappers also avoids the breaking  
>> the logical semantics of arrays (i.e. pass by reference).
>
> You could ease the restriction by disallowing implicit conversion from  
> static to dynamic arrays in certain situations. A function returning a  
> dynamic array cannot return a static array; you cannot assign the return  
> value of a function returning a static array to a dynamic array.
>
> Or in those cases, put the static array on the heap.

I'm not sure what you're referencing.

> A function returning a dynamic array cannot return a static array;
This is already true; you have to .dup the array to return it.

> you cannot assign the return value of a function returning a static  
> array to a dynamic array.
This is already sorta true; once the return value is assigned to a  
static-array, it may then be implicitly casted to dynamic.

Neither of which help the situation.




More information about the Digitalmars-d mailing list