Skip to content

Commit 612adf5

Browse files
committed
DOC: Add "Integer Type Specifiers" section
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"
1 parent 6525a5c commit 612adf5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,21 @@ \subsection{Const Correctness}
13761376
\end{itemize}
13771377
13781378
1379+
\subsection{Integer Type Specifiers}
1380+
\label{subsec:IntegerTypeSpecifiers}
1381+
1382+
Throughout the code base, the built-in type \code{unsigned int} is spelled exactly like that:
1383+
``unsigned int'' (rather than just ``unsigned''). Other built-in integer types should in
1384+
general be specified by their shortest form. For example, ``short'', ``long'', and ``long long''
1385+
are preferred to ``signed short int'', ``signed long int'', and ``signed long long int''.
1386+
1387+
Within the \code{itk} namespace, integer type aliases from C++ Standard headers for C library
1388+
facilities (like \code{<cstdlib>} and \code{<cstdint>}) should generally be used without a \code{std::} prefix.
1389+
For example, ``size\_t'', ``int8\_t'', and ``uintmax\_t'' are preferred to ``std::size\_t'',
1390+
``std::int8\_t'', and ``std::uintmax\_t''. When using any of those type aliases, the ITK header file
1391+
``itkIntTypes.h'' may need to be \code{\#include}d, to ensure that those types are declared within the
1392+
\code{itk} namespace.
1393+
13791394
\section{Namespaces}
13801395
\label{sec:Namespaces}
13811396

0 commit comments

Comments
 (0)