Re: [eigen] strange sizeof on windows

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


aha, great.
Then I know what to do: remove the ei_matrix_with_aligned_operator_new
base class of Matrix, and instead copy and paste the operators there.

It'd be a bit stupid to do this just for one compiler but here really
we've been relying on nonstandard behavior (the EBCO) from something
crucial (that sizeof of our matrices is optimal).

Cheers,
Benoit

2009/1/5 FMDSPAM <fmdspam@xxxxxxxxx>:
> Benoit Jacob schrieb:
>>
>> 2009/1/5 FMDSPAM <fmdspam@xxxxxxxxx>:
>>
>>>>
>>>> can you try this:
>>>>
>>>> struct empty {};
>>>> struct foo : empty
>>>> {
>>>>  float x;
>>>> };
>>>>
>>>> and print sizeof(foo), sizeof(empty), sizeof(float) ?
>>>>
>>>>
>>>
>>> Sure,
>>>
>>> sizeof(foo) = 4
>>> sizeof(empty) = 1
>>> sizeof(float) = 4
>>>
>>
>> Thanks very much. So at least here, your compiler has performed the
>> EBCO (empty base class optimization)
>> http://www.informit.com/articles/article.aspx?p=31473&seqNum=2
>> (Indeed that turns out to be a nonstandard optimization performed only
>> by certain compilers).
>>
>> The question now is, why doesn't it perform the EBCO with Eigen::Matrix ?
>> Maybe it's related to the multiple inheritance. Can you please try:
>>
>> struct empty1 {};
>> struct empty2 {};
>> struct foo : empty1, empty2
>> {
>>  float x;
>> };
>>
>> what is sizeof(foo) now ?
>>
>>
>
> Sure,
>
> sizeof(foo) = 8
> sizeof(empty1) = 1
> sizeof(empty2) = 1
> sizeof(float) = 4
>
> Gotcha! :-(
>
>
> ---
>
>

---


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