Re: [eigen] Alignment of a derived class |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Alignment of a derived class
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Thu, 19 Jul 2012 07:38:37 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=fgV9BbNbHenLBsRWcP+9rRHVc/0fYayqNb8M7qvsCTQ=; b=N5fMe4xwTiAWJ9DFmAMcwP+ECPft9v/Z+K2MR06ga45/kYai9uZa23QeDb9FrVOHZ8 pMV3zsPL89nqFyr6G8ggkbLKRFUutLVBoOeiHgCZ4hvxSZZltUUiwASv3ARJl1bPO3Cg nFXvzFefz5DrLu2qkA8heV2W3SlgZUoiFdrGM9B2Tg9XEpF9FBPTTu6uQ/58tj62kPcU BnCLFVvh6jV8ilzE1f3g5OrzVopxgedfVEa5gHfY8DP7VUMMLcfg4nVTF9AczM9kx63m LYAmqAzbbXjTzP4LLvxKMcXR4aAMFKIIUkNTwfz5hhIDl8DjRuJaU3FvFDnAJZKgUcI8 +HKA==
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
> ----------------------------------------------
>
>