How to write portable code in c++?

后端 未结 12 1995
情话喂你
情话喂你 2020-11-30 03:47

What are the things that I should keep in mind to write portable code? Since I\'m a c++ beginner, I want to practice it since beginning.

Thanks.

12条回答
  •  旧巷少年郎
    2020-11-30 04:36

    a good idea is to use POSIX system calls. that way you don't have to deal with different ways of creating threads or using mutexes and signals.

    the problem is that Windows is not exactly POSIX compliant, but there are libraries that implement certain POSIX features, like this one: [1]: http://sourceware.org/pthreads-win32/

提交回复
热议问题