STYLE: Replace itk::NumericTraits<unsigned int>::OneValue() with 1#4467
Conversation
Follow-up to pull request InsightSoftwareConsortium#4460 commit 5d746cc "STYLE: Replace `NumericTraits<unsigned int>::ZeroValue()` with `0U`"
dzenanz
left a comment
There was a problem hiding this comment.
Does 1 vs 1u make any difference?
In practice, when you assign the value ( |
|
I am pretty sure at some point there was a compiler warning flag used that warned about conversions from int to unsigned int, and the draconian usage itk::NumericTraits was used to help determine where real conversion issues were occurring. |
|
itkOBJMeshIO.cxx does ITK/Modules/IO/MeshOBJ/src/itkOBJMeshIO.cxx Line 171 in 45ca040 |
|
If anyone insists on BTW, I would use uppercase |
Thanks for explaining, @blowekamp. Nowadays I think the main reason for using itk::NumericTraits would be to support pixel types in a generic way. Specifically, |
The other case to consider is with itk::SizeType or std::std size type. The size of "long" and "long long" vary across systems and can change based on the word size for the architecture on some, but not other platforms. |
OK, but for a built-in integer type (or a typedef or alias of a built-in integer type), |
Follow-up to pull request #4460 commit 5d746cc
"STYLE: Replace
NumericTraits<unsigned int>::ZeroValue()with0U"