Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the pros & cons of pre-compiled headers specifically in a GNU/Linux environment/tool-chain?

Tags:

Pre-compiled headers seem like they can save a lot of time in large projects, but also seem to be a pain-in-the-ass that have some gotchas.

What are the pros & cons of using pre-compiled headers, and specifically as it pertains to using them in a Gnu/gcc/Linux environment?

like image 608
Catskul Avatar asked Aug 27 '09 20:08

Catskul


People also ask

Whats the meaning of pros?

adverb. in favor of a proposition, opinion, etc. noun, plural pros. a proponent of an issue; a person who upholds the affirmative in a debate. an argument, consideration, vote, etc., for something.

What's pros and cons mean?

Definition of pros and cons 1 : arguments for and against —often + of Congress weighed the pros and cons of the new tax plan. 2 : good points and bad points Each technology has its pros and cons.

What is the full of pros?

Pro is an abbreviation meaning "professional".

What are the pros and cons of pros and cons?

What is a Pros and Cons List? A pros and cons list is a quick and easy decision-making tool. Pros are arguments FOR taking a particular path. Cons are arguments AGAINST.


1 Answers

The only potential benefit to precompiled headers is that if your builds are too slow, precompiled headers might speed them up. Potential cons:

  • More Makefile dependencies to get right; if they are wrong, you build the wrong thing fast. Not good.

  • In principle, not every header can be precompiled. (Think about putting some #define's before a #include.) So which cases does gcc actually get right? How much do you want to trust this bleeding edge feature.

If your builds are fast enough, there is no reason to use precompiled headers. If your builds are too slow, I'd consider

  • Buying faster hardware, which is cheap compared to salaries

  • Using a tool like AT&T nmake or like ccache (Dirk is right on), both of which use trustworthy techniques to avoid recompilations.

like image 174
Norman Ramsey Avatar answered Oct 29 '22 18:10

Norman Ramsey