www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Unused routines and inlining

reply Cecil Ward <cecil cecilward.com> writes:
(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?
Jun 24 2023
parent Cecil Ward <cecil cecilward.com> writes:
On Saturday, 24 June 2023 at 16:55:05 UTC, Cecil Ward wrote:
 (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.)

 [...]
s/medium sized routine/medium-sized module/
Jun 24 2023