4 ms·
I've recently had to enable C++11 in a project because a header I use added C++11 features, and it appears that going from C++98 to C++11 makes Clang and G++ co
by cm3 11y ago
I've recently had to enable C++11 in a project because a header I use added C++11 features, and it appears that going from C++98 to C++11 makes Clang and G++ considerably slower. Can anybody else confirm this?
- majewsky 11y agoDid you test the --std change in isolation, without your new headers? Some libraries' headers are ridiculously expensive when they make heavy use of templates. My favorite in that regard is Boost::Qi.
- cm3 11y agoHow do I test it in isolation without including and making use it as before (aka no code change in the consumer of the previously C++98 header)?
- jononor 11y agoCheckout the version before you introduced the C++11 header. Alternatively, fix the header to be C++98 compatible (may of course be non-trivial).
- netheril96 11y agoJust compile the previous version that conforms to C++98 with different std flags and do the comparison.
- cm3 11y agoRight, that makes sense. Will do, though once confirmed, I will curse C++1x even more, I guess :).
- cm3 11y agoIs there a difference between -std and --std? I've always used -std=FOO.
- denim_chicken 11y agoNot surprising, since c++11 std headers are generally much larger and more complex.
- cm3 11y agoThis may explain it, hadn't thought of that. The header in question used C++11 atomics and therefore included a new header, which of course, due to the non-existing module system of C++ mean, means my code pulls it in as well. I know of the plans to add a module system to C++, but (1) I'm not sure it would solve this issue and require each header to have a corresponding module (2) and am skeptical of the availability and support in the field. It is much, much easier to just use Rust or OCaml, honestly, and the combination of Rust+OCaml or Rust+Haskell might be the sweet spot.