Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7683
| From | Thomas Boell <tboell@domain.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: header only C++ code or not? |
| Date | 2011-07-09 16:23 +0200 |
| Organization | albasani.net |
| Message-ID | <20110709162332.176f4fa8@arcadia> (permalink) |
| References | (1 earlier) <20110707142407.4e2f0d3c@arcadia> <iv4ag9$1bku$1@news.ett.com.ua> <almarsoft.1152109586541198850@news.eternal-september.org> <20110707193818.3b345f93@arcadia> <almarsoft.6591275520505106110@news.eternal-september.org> |
On Sat, 09 Jul 2011 09:06:11 -0400 Garrett Hartshaw <ghartshaw@gmail.com> wrote: > On Thu, 7 Jul 2011 19:38:18 +0200, Thomas Boell > <tboell@domain.invalid> wrote: > > On Thu, 07 Jul 2011 11:40:22 -0400 > > Garrett Hartshaw <ghartshaw@gmail.com> wrote: > > > > > On Thu, 7 Jul 2011 14:57:44 +0200, "Balog Pal" <pasa@lib.hu> > wrote: > > > > "Thomas Boell" <tboell@domain.invalid> > > > > > > > > > > In addition to what others said, putting implementation in > header > > > files > > > > > can give the compiler better chances for optimization and > > > inlining. If > > > > > the implementation is in a separate compilation unit, the > compiler > > > > > can't inline because it doesn't know the function body. > > > > > > > > > > Nothing enforces the classic "dumb linker" model. > > > > > > Newer gcc versions have the -flto option for this purpose. I > don't > > > know about other compilers. > > > > Nice. I didn't know about GIMPLE and the -flto flag. > > > > It seems to be rather new (released in May 2010 with gcc 4.5 > > apparently). If it's true that code using LTO is effectively > compiled > > twice [1], then that could be a reason why one would not want to > use it. > > > > [1] http://lwn.net/Articles/387447/ > > Yeah, it is pretty new. I'm not sure about the whole compiles twice > thing, but it hasn't seemed too much slower when I've used it. The documentation says it also doesn't play well together with debug symbols (yet). Doesn't matter if you turn off optimizations when debugging of course.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
header only C++ code or not? kathy <yqin_99@yahoo.com> - 2011-07-06 14:27 -0700
Re: header only C++ code or not? "Andrew Holme" <ah@nospam.com> - 2011-07-06 22:42 +0100
Re: header only C++ code or not? "Bo Persson" <bop@gmb.dk> - 2011-07-07 19:17 +0200
Re: header only C++ code or not? Sam <sam@email-scan.com> - 2011-07-06 17:23 -0500
Re: header only C++ code or not? Noah Roberts <roberts.noah@gmail.com> - 2011-07-06 16:14 -0700
Re: header only C++ code or not? "MikeP" <mp011011@some.org> - 2011-07-07 15:35 -0500
Re: header only C++ code or not? "MikeP" <mp011011@some.org> - 2011-07-07 15:45 -0500
Re: header only C++ code or not? "Paul" <pchristor@yahoo.co.uk> - 2011-07-07 01:24 +0100
Re: header only C++ code or not? Thomas Boell <tboell@domain.invalid> - 2011-07-07 14:24 +0200
Re: header only C++ code or not? "Balog Pal" <pasa@lib.hu> - 2011-07-07 14:57 +0200
Re: header only C++ code or not? Garrett Hartshaw <ghartshaw@gmail.com> - 2011-07-07 11:40 -0400
Re: header only C++ code or not? Thomas Boell <tboell@domain.invalid> - 2011-07-07 19:38 +0200
Re: header only C++ code or not? Garrett Hartshaw <ghartshaw@gmail.com> - 2011-07-09 09:06 -0400
Re: header only C++ code or not? Thomas Boell <tboell@domain.invalid> - 2011-07-09 16:23 +0200
Re: header only C++ code or not? "Bo Persson" <bop@gmb.dk> - 2011-07-07 19:16 +0200
csiph-web