PDA

View Full Version : Quick question on C++ compilers


Chromium
Oct5-09, 06:37 PM
Is it true that most, if not all, C++ compilers tend to compile the same .h files over and over again? Say there are two .cpp files that include the same .h file, and the compiler processes one of these .cpp files & all its included header files as well. Once it gets to the second .cpp file, it doesn't recognize that it has seen the one .h file before, and so it just processes that file again, right?

Borek
Oct5-09, 06:52 PM
Not necesarrilly. Visual compilers (Microsoft) prepare something they call precompiled header to save on resources/compilation time. I suppose other compilers are able to do the same.

Chromium
Oct5-09, 07:00 PM
Oh, I see. Although I guess it makes more sense to use precompiled headers, isn't it possible to turn that feature off (I guess it depends on the compiler)?

Borek
Oct6-09, 03:25 AM
On/off, as you wish.