public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Do definitions in headers still help optimization?
@ 2024-01-12 14:07 Licht Martin Werner
  2024-01-12 14:49 ` LIU Hao
  0 siblings, 1 reply; 5+ messages in thread
From: Licht Martin Werner @ 2024-01-12 14:07 UTC (permalink / raw)
  To: gcc-help

Dear all,

Does keeping definitions of functions in header files still help the 
compiler optimize your code? Or is that advice outdated?

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.

Martin



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-14 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-12 14:07 Do definitions in headers still help optimization? Licht Martin Werner
2024-01-12 14:49 ` LIU Hao
2024-01-12 16:01   ` Xi Ruoyao
2024-01-12 17:58     ` LIU Hao
2024-01-14 10:44       ` Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).