retard wrote:
Just looking at the executable size (when compiled with dmc, the latter program is 30 kB and the first one is ~40 kB) makes it pretty clear that dmc/optlink does not optimize this.

Yes, it does, if you use the -Nc (function level linking) switch when compiling. dmd puts functions in COMDATs by default. Some older C programs require that the layout of functions in memory match their appearance in the source file, hence dmc doesn't do that by default.

http://www.digitalmars.com/ctg/sc.html#dashCapNc


Unfortunately I'm not buying a windows / full dmc license to be able to objdump the executable so it's a bit hard to see what's inside it.

You can get OBJ2ASM for $15 as part of the Extended Utility Package. I think it's worth every penny!

http://www.digitalmars.com/shop.html

Reply via email to