Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Notes on compilers
igatools is heavily based on templates and templates-metaprogramming techniques. This approach produces some benefits, among which we can mention:
- a strict control on the types at compile time (resulting in a drastic reduction of possible bugs introduced in the code)
- computational efficiency
- code compactness
On the other end, the amount of work done by the compiler and the difficulty for compiling this kind of structures, push the compiler itself to its limit.
During the development of igatools we had the experience that sometimes we used some constructs that were perfectly legal in C++14, but the current (at that time) version of the compiler did not implement that kind of construct, so we had to re-code the same functionality with a less elegant/more "hackish" approach. In order to be C++14 compliant, we constantly look for the most updated compiler versions and we are trying to avoid/reimplement the "hacks" we made.
Our experience is that clang is more adherent to the C++14 standard, is faster to compile igatools, requires less memory during the compilation process, is rock solid, and the coding errors are reported in a very clear way (and if you program with templates, you know how awful and verbose can appear an error message). The only drawback is that its produces executables that are less efficient than gcc.
On the other hand, gcc produces more efficient executables w.r.t clang, but sometimes we got some segmentation faults (during the compilation phase!!!), depending on which option in the code we activated. Moreover, when we had no segfaults, we have noticed that the memory and time required by the compilation phase was bigger than the one required by clang. We hope that the next gcc release, will solve this issues.