Re: [eigen] Alignment of a derived class

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On Thu, Jul 19, 2012 at 6:48 AM, Christoph Hertzberg
<chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On 18.07.2012 23:29, Gael Guennebaud wrote:
>>
>> On Wed, Jul 18, 2012 at 4:18 AM, Martin Sälzle <martin.saelzle@xxxxxxx>
>> wrote:
>>>
>>> struct Base
>>> {
>>>    Eigen::Vector4f vec4f_base;
>>>    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
>>> };
>>>
>>> struct Derived1 : public Base
>>> {
>>>    Eigen::Vector4f vec4f_derived_1;
>>>    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
>>> };
>>>  [...]
>>>
>>> The final question is what would happen for Derived1 if Base does note
>>> have EIGEN_MAKE_ALIGNED_OPERATOR_NEW?
>>
>>
>> On a 64bits system nothing special. On a 32bits system with SSE
>> enabled, an abort or segfault if you create a Derived1 on the heap
>> using "new Derived1".
>
>
> Actually, if Derived1 still has an EIGEN_MAKE_ALIGNED_OPERATOR_NEW, it
> should be ok to use `new Derived1`, shouldn't it?

Sure!

gael

> Of course it is better to just add EIGEN_MAKE_ALIGNED_OPERATOR_NEW to the
> base class -- and it won't harm if you add it to the derived classes as
> well.
>
> Christoph
>
>
>
>
>
> --
> ----------------------------------------------
> Dipl.-Inf. Christoph Hertzberg
> Cartesium 0.049
> Universität Bremen
> Enrique-Schmidt-Straße 5
> 28359 Bremen
>
> Tel: +49 (421) 218-64252
> ----------------------------------------------
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/