c42f / tinyformat

Minimal, type safe printf replacement library for C++
531 stars 75 forks source link

Include cassert only if necessary #49

Closed krlmlr closed 6 years ago

krlmlr commented 6 years ago

I'm not sure if this the right thing to do. There are advantages to having a stable set of included files.

Thanks for the very quick review of #48!

c42f commented 6 years ago

I'm not sure this is really worth it. Looking at the contents of <cassert>, it's only adding a couple of hundred lines:

chris@xyz:~/dev/tinyformat$ g++ -E tinyformat.h  | wc -l
37251

chris@xyz:~/dev/tinyformat$ vim tinyformat.h # Remove cassert line

chris@xyz:~/dev/tinyformat$ g++ -E tinyformat.h  | wc -l
37035

So only an additional 200 lines out of 37000 for the rest of the includes. And about half of those seem to be comments or blank lines.

c42f commented 6 years ago

I assume the motivation here is the general (good) principle of avoiding unnecessary includes?

krlmlr commented 6 years ago

Yes; on the other hand, consistent include files are also a nice thing to have.

c42f commented 6 years ago

Hmm, well I could take it or leave it. Guess I'll take it :-)