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:14:12 +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=juooh8BMddH3DtEhykORPpERkp99ZbD1gGsX4SUGuo0=; b=FGiNSKnI+OZ9rCQ3CoMUyvu+oUWRE5UgJVXKCOPdWdK0Csf4L/TeXJN9GCDWyjB9tM KIzfICa7ziLT2SBvHz0ElPWZ8tSWqWhnq8A88Ypb4aA+Bcg8XPqj4x0OAad3sb5Ww/tC DLLNlQkEc7uzZnFIClpnWQQPe6YUOmMKxO7Lo=
- 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=i/g33YRvUCjKWA6Jdyw7chCxmo5cNxQsmyIsX209szRxPaJpU/6IO5cCx0jwiP6nEJ Qu6Y18GYYu0Uh6q13JAG1DbvvCPI3yOCq32cqlwgTkuEWuFfqD9N/qBmEpTrti30wK+x +quhiQiUDsYqnAyG1uY5k08R4u6B2UUhsgqBM=
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 ?
Cheers,
Benoit
>
>
>
> ---
>
>
---