You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
- 3I fail to see the objection to this method. Assuming you generate the includes from a script or Makefile, it is not a maintenance problem. It does in fact speed up compilation without obfuscating compilation issues. You could argue memory consumption on compilation but that is rarely an issue on modern machine. So what is the object to this approach (aside from the assertion that it's wrong)?rileyberton– rileyberton2013-03-04 01:33:09 +00:00Commented Mar 4, 2013 at 1:33
- 9@rileyberton (since someone upvoted your comment) let me spell it out: no it doesn't speed compilation up. In fact, it makes sure that any compile takes the maximum amount of time by not isolating translation units. The great thing about them is, that you don't need to recompile all .cpp-s if they didn't change. (That's disregarding stylistic arguments). Proper dependency management and perhaps precompiled headers are much much better.sehe– sehe2013-03-04 08:55:24 +00:00Commented Mar 4, 2013 at 8:55
- 8Sorry, but this can be a very efficient method for speeding up compilation, because you (1) pretty much eliminate linking, and (2) only have to process commonly used headers once. Also, it works in practice, if you bother to try it. Unfortunately, it makes incremental rebuilds impossible, so every build is completely from scratch. But a full rebuild with this method is a lot faster than what you'd get otherwiseStack Overflow is garbage– Stack Overflow is garbage2013-03-04 09:00:25 +00:00Commented Mar 4, 2013 at 9:00
- 4@BartekBanachewicz sure, but what you said was that "it doesn't speed compilation up", with no qualifiers. As you said, it makes every compile take the maximum amount of time (no partial rebuilds), but at the same time, it dramatically reduces the maximum compared to what it'd otherwise be. I'm just saying it's a bit more nuanced than "don't do this"Stack Overflow is garbage– Stack Overflow is garbage2013-03-04 09:04:19 +00:00Commented Mar 4, 2013 at 9:04
- 2Have fun with static variables and functions. If I want a big compilation unit, I'll create a big .cpp file.gnasher729– gnasher7292014-03-27 09:17:46 +00:00Commented Mar 27, 2014 at 9:17
| Show 5 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. python-3.x), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-cpp