Skip to content

Commit

Permalink
DOC: Add "Integer Type Specifiers" section
Browse files Browse the repository at this point in the history
Added coding style guidelines for specifying built-in integer types and
integer types from the C library.

Following recent ITK commits, authored by Lee Newberg:

pull request InsightSoftwareConsortium/ITK#3365
commit InsightSoftwareConsortium/ITK@8c2c654
commit InsightSoftwareConsortium/ITK@e03a941
"STYLE: Drop `signed` and `int` from some types"

pull request InsightSoftwareConsortium/ITK#3139
commit InsightSoftwareConsortium/ITK@a812aa3
"STYLE: Change unsigned to unsigned int."

pull request InsightSoftwareConsortium/ITK#3250
commit InsightSoftwareConsortium/ITK@c173dfd
"STYLE: Remove `std::` prefix from types that work without it"
  • Loading branch information
N-Dekker committed Feb 28, 2023
1 parent 6525a5c commit 612adf5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,21 @@ \subsection{Const Correctness}
\end{itemize}
\subsection{Integer Type Specifiers}
\label{subsec:IntegerTypeSpecifiers}
Throughout the code base, the built-in type \code{unsigned int} is spelled exactly like that:
``unsigned int'' (rather than just ``unsigned''). Other built-in integer types should in
general be specified by their shortest form. For example, ``short'', ``long'', and ``long long''
are preferred to ``signed short int'', ``signed long int'', and ``signed long long int''.
Within the \code{itk} namespace, integer type aliases from C++ Standard headers for C library
facilities (like \code{<cstdlib>} and \code{<cstdint>}) should generally be used without a \code{std::} prefix.
For example, ``size\_t'', ``int8\_t'', and ``uintmax\_t'' are preferred to ``std::size\_t'',
``std::int8\_t'', and ``std::uintmax\_t''. When using any of those type aliases, the ITK header file
``itkIntTypes.h'' may need to be \code{\#include}d, to ensure that those types are declared within the
\code{itk} namespace.
\section{Namespaces}
\label{sec:Namespaces}
Expand Down

0 comments on commit 612adf5

Please sign in to comment.