Note that there are some explanatory texts on larger screens.

plurals
  1. POResources for cross-platform C/C++ development
    text
    copied!<p>What resources exist to aid in writing C/C++ code that works across multiple platforms and compilers? For example, I regularly find myself asking questions like:</p> <ul> <li>Which preprocessor macros are automatically defined in various compilers and environments? (e.g. <code>__GCC__</code>, <code>WIN32</code>, <code>__WIN32__</code>, <code>__CYGWIN__</code>)</li> <li>Which versions of compilers and standard libraries support relatively new "standard" functions (e.g. the C99 long double trigonometric functions sinl(), cosl(), ...)</li> <li>What functions are available on different platforms for performing typical tasks, when no single portable function seems to exist? (e.g. getting the current time with sub-second precision)</li> </ul> <p>I often write code that should compile under Linux/gcc, cygwin, mingw32, and Visual Studio, and I frequently have to compare notes from multiple sources (Linux man pages, MSDN, compiler docs) to get the information I need. This must be a problem that developers run into all the time -- are there any resources that compile this information into an easily digestible reference?</p> <p>(For this question I'm not particularly interested in cross-platform libraries like wxWidgets or boost. I'm more interested in resources or techniques that would help somebody write their own cross-platform library or program.)</p> <p>EDIT: This is an example of the type of page I'm looking for: <a href="http://predef.sourceforge.net/precomp.html" rel="nofollow noreferrer">http://predef.sourceforge.net/precomp.html</a>. A nice survey of various compilers/environments and the preprocessor macros that can be used to identify them. It would be great to find a similar resource that compared nearly-equivalent functions across platforms (like gmtime_r() or ftime() in Linux vs _gmtime_s() or _ftime() in Windows) when no common function exists.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload