CAUTION!

CAUTION! DANGER ZONE ahead. Beware of misinformation on the open internet. Contents of the site are mere opinions and are not always facts!

Wednesday, August 6, 2014

Is C++ truly cross-platform?

Is C++ truly cross-platform?

The answer is yes! the C++ language standard is. Code written to comply with this standard is cross platform.

Porting the code to various platforms gets difficult when non standard code is written to accomplish more useful tasks.

1. We need OS APIs for Multi-Threading, Networking, GUI etc. There are several cross platform (common interface with different implementations) libraries like Boost, QT, libcurl, cpp-netlib etc that provide the same OS specific functionality on different platforms.

2. The code should be compiled for different platforms and we need compilers that supports the same version of C++ on different platforms. Compiler specific types or directives shouldn't be used.

3. Non standard use cases like character encoding and Endianness should be considered.

Non standard code can anymore be avoided with the introduction of new versions of C++, C++11 and C++14; and cross platform compilers, Clang.

Thus, writing truly cross platform C++ should be a piece of  ðŸŽ‚!!!

No comments:

Post a Comment