38,763
edits
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 13: | Line 13: | ||
ISO standards typically rely on other standards and C++ is no exception. The ISO C++ standards rely on the ISO C standards definitions (per the text, restrictions, etc. in the ISO C++ standard). Consequently, if you require the ISO C++ standard document you will likely also require the ISO C standard document it relies on. | ISO standards typically rely on other standards and C++ is no exception. The ISO C++ standards rely on the ISO C standards definitions (per the text, restrictions, etc. in the ISO C++ standard). Consequently, if you require the ISO C++ standard document you will likely also require the ISO C standard document it relies on. | ||
=References= | |||
<references/> | |||
=Well-Defined Concurrency and Memory Models= | =Well-Defined Concurrency and Memory Models= | ||
Line 45: | Line 48: | ||
==Compilers== | ==Compilers== | ||
===GCC=== | ===GCC=== | ||
====-O3==== | |||
The GCC compiler's -O3 option includes possibly unsafe optimizations for some types of code (e.g., code relying on aliasing). If unsure, compile and optimize code using the -O2 option instead. If you've more time, read the man page (e.g., <tt>man g++</tt>) and unset the appropriate options by searching for "-O3" to see which options are turned on and turn off the settings that are not safe. | The GCC compiler's -O3 option includes possibly unsafe optimizations for some types of code (e.g., code relying on aliasing). If unsure, compile and optimize code using the -O2 option instead. If you've more time, read the man page (e.g., <tt>man g++</tt>) and unset the appropriate options by searching for "-O3" to see which options are turned on and turn off the settings that are not safe. | ||
====Linking With Older Previously-Compiled Binaries==== | |||
The transition from GCC version 4.9 to version 5.1 introduced a major change to its ABI. If all source code including all dependent libraries is recompiled using the same version of the compiler then there will be no issues. If different compilers are used, the ABI change may cause linking to fail. The latter is likely to occur if you are linking to precompiled libraries provided in a vendor's product. If this occurs, you can use GCC's Dual ABI<ref>Free Software Foundation. The GNU C++ Library, Chapter 3. https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html</ref> feature to tell GCC to use the old ABI in order for your application to link properly with those legacy libraries, e.g., you would pass <code>-D_GLIBCXX_USE_CXX11_ABI=0</code> to GCC if using GCC v5.1 or higher to link to libraries built using the older ABI. | |||
We've provided an example of how the ABI is affected by various GCC command-line options here: [[GCC C++ Dual ABI]]. | |||
===Intel=== | ===Intel=== | ||
Intel C/C++ compilers may default to using possibly unsafe optimizations for floating-point operations. Users using the Intel compilers should read the Intel man pages (e.g., <tt>man icpc</tt>) and are recommended to use one of two options, <tt>-fp-model precise</tt> or <tt>-fp-model source</tt>, for ANSI/ISO/IEEE standards-compliant floating-point support. For more details, read this Intel slideshow called, [https://software.intel.com/sites/default/files/article/326703/fp-control-2012-08.pdf Floating-point control in the Intel compiler and libraries]. | Intel C/C++ compilers may default to using possibly unsafe optimizations for floating-point operations. Users using the Intel compilers should read the Intel man pages (e.g., <tt>man icpc</tt>) and are recommended to use one of two options, <tt>-fp-model precise</tt> or <tt>-fp-model source</tt>, for ANSI/ISO/IEEE standards-compliant floating-point support. For more details, read this Intel slideshow called, [https://software.intel.com/sites/default/files/article/326703/fp-control-2012-08.pdf Floating-point control in the Intel compiler and libraries]. | ||
=References= | |||
<references/> |