I am peeking through the code of torsocks where as you'll notice, the .travis.yml file instructs Travis CI to test against both clang and gcc.

  - clang
  - gcc

I'm still learning and this caught my attention. Why both? Why not just one or the other? Thanks!


The two compilers have different quirks, and different levels of support for the various C and C++ standards. Code that compiles for one may trigger an error on the other. If you want folks to be able to build your software using either compiler, you have to test that you've accomodated for the differences between the compilers.

  • Thanks, I guess that was pretty obvious in retrospect haha.
    – Alex V
    Dec 14 '18 at 0:55
  • It also effectively prevents using compiler-specific features that would limit portability. Dec 14 '18 at 1:43
  • 1
    @AlexReinking actually you can still take advantage of compiler specific features, but you have to have a more elaborate build, and you may need to use the preprocessor to support alternative blocks of code for each compiler. Dec 14 '18 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.