Notes on compilers

Massimiliano Martinelli edited this page Feb 10, 2016 · 4 revisions

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
  • etc.

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.

Right now (February 2016) we compile and test igatools (on Linux and Mac OS X) with two different compilers: clang-3.7.0 and gcc-5.3.0.

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.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.