Unused routines and inlining

Cecil Ward cecil at cecilward.com
Sat Jun 24 16:55:05 UTC 2023


(Apologies if I have talked about this before, but my memory is 
shot because of strong pain drugs that I’m on, and it never was 
any good before either, so I may be repeating myself.)

I’m using GDC and LDC, comparing the two, and in a medium sized 
routine that I have written pretty much every routine is inlined 
all the time. No-one takes the addresses of the routines, and 
they are not called externally to the module, marked private. (Is 
that the same as ‘static’ in C and D ?) So there’s no reason for 
the compiled copies of the function bodies to still exist. This 
makes the module unnecessarily huge with all this unused code 
just sitting there. Is there anything I can be doing about this, 
to make them go away, with appropriate configuration?

It’s a wishlist item for the compilers, to check for 
zero-usage-count in functions that are always inlined, private 
and where there’s no pointer-taking so no chance of indirect 
calls. Is that sufficient?


More information about the Digitalmars-d-learn mailing list