Win32 API Tango / using what ?

Stewart Gordon smjg_1998 at yahoo.com
Thu Nov 15 07:55:27 PST 2007


"Sascha Katzner" <sorry.no at spam.invalid> wrote in message 
news:fhec86$9pi$1 at digitalmars.com...
<snip>
>> The above also means that the binary size increase a lot, as every module
>> compiled into a D program, adds about 500 bytes.
>> The direct port meant using static const variables a lot, and these was 
>> put
>> into the executable, increasing binary size by a large quantity of bytes.
>> Using enums instead would fix this, but seemed like an onerous task at 
>> the
>> time.
>
> I don't know if static const have this effect but we use enums anyway 
> everywhere it is reasonable: 
> http://www.dsource.org/projects/bindings/wiki/WindowsApi/Instructions
<snip>

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.

-- 
My e-mail address is valid but not my primary mailbox.  Please keep replies 
on the 'group where everybody may benefit. 




More information about the Digitalmars-d mailing list