Re: [eigen] strange sizeof on windows |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] strange sizeof on windows
- From: "Benoit Jacob" <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 5 Jan 2009 17:22:51 +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=xRn3I58moorTjWaKzmMigH57gyOQz/l8bEGJvw88kEc=; b=smvTX1+hPwoGi2547QlQFrBaLk3eC1kYM6f92swG+VxSVCl00sHYnXv6Ld9QNSvcvm pDXTKU4CCd2QYD8kmEBZG+NDuznwhS+G61XeSGevnhTNExYHNzBR0ciNDGfMTxnElvRM DVHSQpFN5iXF6IV4fhuFpFvLqEj1225hsXl8s=
- 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=mMv+FHsTC+kuKbZo1r6LPGhJpvSK2hhrFK09UkmvBHNbNrMY5G0x77r2pLVYvxqpkS dvpP89VpuF4bLD3UbfCFDaSJM7sk/Ty4zvZ0jQEX8KQE/Oja6bRjEmcBEAa2fqg6ePqo B7xKfUrKI4+1YbrCj3YUEmV9ndIdKN3bAxU3o=
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! :-(
>
>
> ---
>
>
---