Re: [eigen] Multiple inheritance and WithAlignedOperatorNew vs. Msvc |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Multiple inheritance and WithAlignedOperatorNew vs. Msvc
- From: "Benoit Jacob" <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 6 Jan 2009 04:19:58 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=dJ/Zu5Oxm9FLI5N6HzYnbBEOMIZ6csfEIcGH5R89xV8=; b=jj6kp5NnxN/N7OoCxubBNKzdDY5YC5jbSkxvSkHM5bAKL8B48YIEz61yjiQ3kZ+ZmB 6VzomkckVyMbxYshUvXP5+BODAkTBERRnWxrN2aIMyU+yoJryYJAH3lnVUtUutaOob5b OCXIwwVzXJ7DkQTO5zAV0mZrdygbEQBM1D7sI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=B137q0WvB3BW7tNpAlEZJ/lN2BxHvgrxOs1DhlIdDT9PoFf+o2uu/bePZqp7A0bGKU L9q8Kg2mK8fv89jO4k6pemsKx/h68mPlxYYYFZnqDppumdh1C0dbwCgKCQHU8cz3zIR6 dONF8nKlRnAJ1dxxATfKGhM49ei+VHDFM8vrQ=
svn up, here you are...
the macro is EIGEN_MAKE_ALIGNED_OPERATOR_NEW. Just put it in the
public part of your class.
If you want to align or not depending on some template parameter, use
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(condition)
I have updated the 'unaligned array assert' dox page, but to see it
you need to generate the dox yourself (make doc).
Cheers,
Benoit
2009/1/6 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> I have no idea what's going on.
>
> But I have an idea of a workaround. Instead of a base class
> WithAlignedOperatorNew, let's offer a macro to generate these
> operators.
>
> That's probably a better solution anyway, and that's what we're
> already doing (since today) in Matrix.
>
> Opinions?
>
> Benoit
>
> 2009/1/5 Armin Berres <trigger@xxxxxxxxxxxxxx>:
>> Hey dudes,
>>
>> I have a very special present for you:
>> Code which is completely fine with Gcc (at least compiled as 32bit and
>> executed on 64bit Linux), but happily fails with Msvc 2008 at runtime.
>>
>> struct B {};
>>
>> struct A : public B, public Eigen::WithAlignedOperatorNew
>> {
>> Eigen::Matrix2f m;
>> };
>>
>> int main()
>> {
>> A *a = new A();
>> }
>>
>> Guess what, it fails with an assertion claiming that A doesn't inherit from
>> WithAlignedOperatorNew, which means our friendly matrix 'm' is not aligned.
>> So far, so good, but this is not all: If I now add a Matrix to B (and
>> leave the rest of the code unchanged) the assertion is gone.
>> Has anyone the slightest idea what's going on here? Letting B inherit
>> WithAlignedOperatorNew instead of A also solves the problem btw., but there
>> are a lot of situations where one can't change the base class.
>>
>> Puzzled,
>> Armin
>>
>> ---
>>
>>
>
---