What resources exist for writing C / C ++ code that runs on multiple platforms and compilers? For example, I regularly ask questions such as:
- What preprocessor macros are automatically detected in different compilers and environments? (e.g.
__GCC__ , WIN32 , __WIN32__ , __CYGWIN__ ) - Which versions of compilers and standard libraries support relatively new "standard" functions (for example, long double trigonometric functions C99 sinl (), cosl (), ...)
- What functions are available on different platforms to perform typical tasks when there is no single portable function? (for example, obtaining the current time accurate to the second second)
I often write code that should compile for Linux / gcc, cygwin, mingw32 and Visual Studio, and I often have to compare notes from several sources (Linux man pages, MSDN, compiler documents) to get the information I need. This should be a problem that developers face all the time - are there any resources that compile this information into an easily digestible link?
(For this question, I am not particularly interested in cross-platform libraries such as wxWidgets or boost. I am more interested in resources or methods that will help someone write their cross-platform library or program.)
EDIT: This is an example of the type of page I'm looking for: http://predef.sourceforge.net/precomp.html . A good overview of the various compilers / environments and preprocessor macros that can be used to identify them. It would be great to find a similar resource that compared almost equivalent functions on different platforms (for example, gmtime_r () or ftime () on Linux vs _gmtime_s () or _ftime () on Windows) when there is no common function.
c ++ c portability
Kevin ivarsen
source share