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 Apr 8, 2022
1 parent 3fc066d commit 8ddd3d6
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}
Thoughout the code base, the built-in type `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 `itk` namespace, integer type aliases from C++ Standard headers for C library
facilities (like `<cstdlib>` and `<cstdint>`) should generally be used without a `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 `#include`d, to ensure that those types are declared within the
`itk` namespace.
\section{Namespaces}
\label{sec:Namespaces}
Expand Down

0 comments on commit 8ddd3d6

Please sign in to comment.