Re: [eigen] Alignment of a derived class |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
On 18.07.2012 23:29, Gael Guennebaud wrote:
On Wed, Jul 18, 2012 at 4:18 AM, Martin Sälzle <martin.saelzle@xxxxxxxx> 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?
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/ |