I'm working in a team where there are several different OS present (windows, various linux distributions (Ubuntu, Mint) as well as Macintosh). Projects are passed around and we have already come across some issues.

For example the total path length in windows is 260 characters, whereas linux is more relax (though this is vendor specific and any individual component, directory/file name ect does have a character limit). Therefore one should be mindful of directory structures even if they are working on Linux.

Other issues include the use of restrict characters. What is perfectly acceptable in one OS is not is the other and people should be mindful of this.

I'm sure there are many other issues that I have not ever come across. And so my question is are there any other issues that should be considered when setting up projects that are to be accessed across multiple OS's?


1 Answer 1


Make sure you are writing platform independent code:

A. Public .h/.hpp files should not do not include any .h/.hpp platform specific files.

B. Application code should not call system primitives directly - there should be insulation layer. And this layer it should be expressed as a library not a set of preprocessor directives.

C. Platform specific code (e.g. GUI components) should be separated into separate modules/libraries.

A good rule of thumb is to consider all c- code platform-specific and do not expose or use it directly in c++ code.

BTW, these are good rules even if you work on a single platform - a successful application may live 100 years and we got a new platform crop every 10.

For successful companies the cost of not following these rules can easily come to billions in lost opportunity.

  • 1
    This is pretty specific. People still occasionally like to write applications in Ruby on Rails, y'know. If that example is so yesterday, substitute Typescript, Node, or whatever the latest flavor of the week is. Jul 12, 2017 at 15:42
  • Modern environments are already platform independent. So the issue would hardly arise.
    – zzz777
    Jul 12, 2017 at 17:37
  • That statement is hardly self-evident. People still write iOS applications in Swift and objective C, which is decidedly platform-specific. Jul 12, 2017 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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