mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-07 07:39:32 -06:00
Help/dev: Adopt C++ subset rules in coding guide
Move the C++ subset rules from the `cmake-developer(7)` into our dedicated coding guide since they do not need to be in user-facing documentation.
This commit is contained in:
@@ -19,3 +19,24 @@ format only a subset of files, such as those that are locally modified.
|
|||||||
.. _`clang-format`: http://clang.llvm.org/docs/ClangFormat.html
|
.. _`clang-format`: http://clang.llvm.org/docs/ClangFormat.html
|
||||||
.. _`.clang-format`: ../../.clang-format
|
.. _`.clang-format`: ../../.clang-format
|
||||||
.. _`Utilities/Scripts/clang-format.bash`: ../../Utilities/Scripts/clang-format.bash
|
.. _`Utilities/Scripts/clang-format.bash`: ../../Utilities/Scripts/clang-format.bash
|
||||||
|
|
||||||
|
C++ Subset Permitted
|
||||||
|
====================
|
||||||
|
|
||||||
|
CMake supports compiling as C++98 in addition to C++11 and C++14.
|
||||||
|
In order to support building on older toolchains some constructs
|
||||||
|
need to be handled with care:
|
||||||
|
|
||||||
|
* Use ``CM_AUTO_PTR`` instead of ``std::auto_ptr``.
|
||||||
|
|
||||||
|
The ``std::auto_ptr`` template is deprecated in C++11. We want to use it
|
||||||
|
so we can build on C++98 compilers but we do not want to turn off compiler
|
||||||
|
warnings about deprecated interfaces in general. Use the ``CM_AUTO_PTR``
|
||||||
|
macro instead.
|
||||||
|
|
||||||
|
* Use ``size_t`` instead of ``std::size_t``.
|
||||||
|
|
||||||
|
Various implementations have differing implementation of ``size_t``.
|
||||||
|
When assigning the result of ``.size()`` on a container for example,
|
||||||
|
the result should be assigned to ``size_t`` not to ``std::size_t``,
|
||||||
|
``unsigned int`` or similar types.
|
||||||
|
|||||||
@@ -13,30 +13,6 @@ Introduction
|
|||||||
This manual is intended for reference by developers modifying the CMake
|
This manual is intended for reference by developers modifying the CMake
|
||||||
source tree itself, and by those authoring externally-maintained modules.
|
source tree itself, and by those authoring externally-maintained modules.
|
||||||
|
|
||||||
|
|
||||||
Permitted C++ Subset
|
|
||||||
====================
|
|
||||||
|
|
||||||
CMake is required to build with ancient C++ compilers and standard library
|
|
||||||
implementations. Some common C++ constructs may not be used in CMake in order
|
|
||||||
to build with such toolchains.
|
|
||||||
|
|
||||||
std::auto_ptr
|
|
||||||
-------------
|
|
||||||
|
|
||||||
The ``std::auto_ptr`` template is deprecated in C++11. We want to use it
|
|
||||||
so we can build on C++98 compilers but we do not want to turn off compiler
|
|
||||||
warnings about deprecated interfaces in general. Use the ``CM_AUTO_PTR``
|
|
||||||
macro instead.
|
|
||||||
|
|
||||||
size_t
|
|
||||||
------
|
|
||||||
|
|
||||||
Various implementations have differing implementation of ``size_t``. When
|
|
||||||
assigning the result of ``.size()`` on a container for example, the result
|
|
||||||
should be assigned to ``size_t`` not to ``std::size_t``, ``unsigned int`` or
|
|
||||||
similar types.
|
|
||||||
|
|
||||||
Adding Compile Features
|
Adding Compile Features
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user