Re: [eigen] operator overloading vs expression templates, and the need to return references

[ Thread Index | Date Index | More Archives ]

as Gael said, you can simply return by value at no cost as long as the
vector fits in 1 SIMD register. However such code would perform poorly
in non-vectorized mode, as you know.

if you want to play with something that only works when the function
is inlined, you can use __attribute__((always_inline))


2009/9/12 Rohit Garg <rpg.314@xxxxxxxxx>:
>> understand correctly that's exactly what you want. But your above code
>> doesn't look safe at all to me: "temp" lives on the stack, when the
>> function returns the stack pointer is decremented and the content of
>> "temp" may then be overwritten.
> Yeah, i know it is dangerous, unless the function is inlined. Inlining
> it is about the only way of making this thing work. I guess i'll just
> have to live with it for now.
> --
> Rohit Garg
> Senior Undergraduate
> Department of Physics
> Indian Institute of Technology
> Bombay

Mail converted by MHonArc 2.6.19+