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:46:23 +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=KjE2jZNr3pBn3iKSX1RQiXtX8+rASJR1W0cVFW+QLpM=; b=H+iZfbPSgfpgsMEHlnqnH4WzoSrJ0DfM3WHGfVy+pacDdvXV+Xa49J+gRd9QzaW681 Goveioopx64L2IPY968ahF3dA3phlleiJ4t1WmyyyiRNjxohfLxyY2HWmzWhDTp+j6NI CYFsAo7jU4jT//U9YEYHCMT2ZDX+5xsk+Xai4=
- 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=ux7Wcp+0lomVEiViGnXvSoEFzBAK5rMJJ4AXzWDYLp3VgxHJlgy20gXVuOs3Yz5/Ox v2C6rWwkNXLbywH4k3U1gaKuCAPiNUv7/cV6lwLax/c79qLT5TT6wAsPd/NZOMA/uKOp x6gIk7iQCiB++G7GxiKwXxia1ZB95mYRJ0KuE=
Committed. Can somebody who has MSVC please svn up and retry
sizeof(Matrix<float,1,1>) and if possible the test_sizeof?
Thanks in advance,
Benoit
2009/1/5 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> 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! :-(
>>
>>
>> ---
>>
>>
>
---