Program size, linking matter, and static this()

Walter Bright newshound2 at digitalmars.com
Mon Dec 19 10:09:42 PST 2011


On 12/19/2011 7:17 AM, Steven Schveighoffer wrote:
> On Fri, 16 Dec 2011 17:55:47 -0500, Walter Bright <newshound2 at digitalmars.com>
> wrote:
>> For example, in std.datetime there's "final class Clock". It inherits nothing,
>> and nothing can be derived from it. The comments for it say it is merely a
>> namespace. It should be a struct.
>
> Although I don't disagree with you that it should be a struct and not a class,
> does it have anything in its vtbl anyways if it's final?

Yes. The pointers to Object's functions, and a pointer to the TypeInfo for that 
class.

> I'm just trying to
> understand what gets pulled in when you import a module with static ctors...

Write some trivial code snippets, compile them, and take a look at the object 
file with obj2asm.


More information about the Digitalmars-d mailing list