November 15, 2007
Stewart Gordon wrote:
> 
> I'm a little confused by this.
> 
> ----------
> const int qwert = 42;
> 
> enum {
>    yuiop = 69
> }
> ----------
> Under DMD 1.023, the .obj file sizes are:
> - for an empty D file, 349
> - with just the const int, 396
> - with just the enum, 605
> - the whole thing, 652
> 
> so they are generating some object code either way.  Strange - I'd always been under the impression they didn't, but were expanded at compile-time and then discarded.  D certainly ought to support purely compile-time symbolic constants.  In 2.007, the whole testcase generates a 666-byte object file.
> 
> Stewart.
> 

Enums generate typeinfo, which is probably what you're seeing.
November 15, 2007
Tomas Lindquist Olsen wrote:
> 
> Enums generate typeinfo, which is probably what you're seeing.

Even unnamed enums?


Sean
November 15, 2007
Sean Kelly wrote:
> Tomas Lindquist Olsen wrote:
>>
>> Enums generate typeinfo, which is probably what you're seeing.
> 
> Even unnamed enums?
> 
> 
> Sean

Hmm. good point. it's definitely outputting static data for the .init property, but actually I think you're right it should not output a distinct instance of TypeInfo_Enum.

Looking at the object files from gdc, it seems like it is putting the symbols for typeid(int) and the TypeInfo_Enum baseclass in the object file though.

Maybe this is actually a harmless a bug.
1 2
Next ›   Last »