在 2024/1/12 22:07, Licht Martin Werner via Gcc-help 写道: > The answer used to be a certain yes when all optimizations were exclusive to the translation unit. > By now, link-time optimization has been a thing for a while, and one might imagine that defining > functions in header does not make a difference for optimization anymore. > > (Of course, placing functions in header files or asking for link-time optimization will affect the > compilation speed and memory use) > > Discussions of this question seem to be based on hearsay, so I'd rather hope for an answer straight > from the source. Thanks. I'm still having a project which usually compiles and links in two minutes, but with LTO would take hours to link. I can give a link if you are interested. I'd like to say that LTO is still not an option for me. -- Best regards, LIU Hao