Re: [eigen] Alignment of a derived class |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Hi Gael,
Thank you very much for your clear answer.
best regards
Martin
Am 18.07.2012 um 17:29 schrieb Gael Guennebaud:
> Hi Martin,
>
> On Wed, Jul 18, 2012 at 4:18 AM, Martin Sälzle <martin.saelzle@xxxxxxx> wrote:
>> Hi,
>>
>> Please consider this example:
>>
>> 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
>> };
>>
>> struct Derived2 : public Base
>> {
>> Eigen::Vector4f vec4f_derived_2;
>> };
>>
>> I would like to know if Derived1 and / or Derived 2 are aligned, given that Base is aligned.
>
> yes for both.
>
>> The next question is if EIGEN_MAKE_ALIGNED_OPERATOR_NEW is needed in the derived class (Derived1 vs Derived2).
>
> No, having it in Base is enough.
>
>> 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".
>
> gael
>
>> thank you and best regards,
>> Martin
>>
>
>