Thread overview | |||||
---|---|---|---|---|---|
|
October 27, 2015 What's in a empty class? | ||||
---|---|---|---|---|
| ||||
With this code: class A { } pragma(msg, __traits(classInstanceSize, A)); I get the output 8 (32-bit). I can account for the first thing a vtable. But that should only cover 4bytes. What's in the other 4bytes? |
October 27, 2015 Re: What's in a empty class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to TheFlyingFiddle | On Tuesday, 27 October 2015 at 21:23:45 UTC, TheFlyingFiddle wrote:
> I can account for the first thing a vtable. But that
> should only cover 4bytes. What's in the other 4bytes?
The monitor used for `synchronized`.
(yes, this is something a lot of people want to remove as it is rarely all that useful yet you pay the price in all D class objects)
|
October 27, 2015 Re: What's in a empty class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Tuesday, 27 October 2015 at 21:28:31 UTC, Adam D. Ruppe wrote:
> On Tuesday, 27 October 2015 at 21:23:45 UTC, TheFlyingFiddle wrote:
>> I can account for the first thing a vtable. But that
>> should only cover 4bytes. What's in the other 4bytes?
>
> The monitor used for `synchronized`.
>
> (yes, this is something a lot of people want to remove as it is rarely all that useful yet you pay the price in all D class objects)
I see Thanks.
|
Copyright © 1999-2021 by the D Language Foundation