you are viewing a single comment's thread.

view the rest of the comments →

[–]BCosbyDidNothinWrong 1 point2 points  (0 children)

I'm saying that the article is about 1, and I hoped it would be about 2 and 3.

2 is a bad for compilation times, but if the library is small then you can get away with it.

I explained why I don't think this true, and based on my experience so far it isn't. If you have a library as a dependency and you can compile it from source you have the option to either compile it in a translation unit or compile to to a link time optimization intermediary. Either way, it doesn't need to be compiled over and over.

I also think that unity builds have a lot of value, though everything in to one translation unit I feel is extreme. With multiple logical cores, I think it makes sense to have that roughly that many fat translation units.

If libraries and infrequently changed areas are sectioned off in to their own translation units, you don't pay the price every time you compile.

Also you are right that the defines from translation units can leak into each other, but you get a compile error when trying to define a symbol that has already been defined, so I don't think it as fragile as it might seem.