[Insight-developers] Why is m_NumberOfThreads signed?

Williams, Norman K norman-k-williams at uiowa.edu
Mon May 16 14:19:15 EDT 2011


Causing a new warning doesn't break backwards compatibility.

Countable things, like apples, oranges, and CPU threads are by definition
non-negative.  You can't have negative apples in a basket, and you can't
have less than zero threads. Unless you find a way to use negative threads
to un-execute code for you.

Using an unsigned int for m_NumberOfThreads is conceptually transparent.

The advantage of things that are conceptually transparent is that if a
user bumps into one, they don't have to think very hard about why they
just bumped into it, and the course of action to walk around it is
unambiguous.

In other words, if the change throws a few warnings, most users will
either ignore them, or they'll look at the code and see how to make the
warning go away. If they originally wrote the code, there's a good chance
they'll remember how they had to make their loop counter signed when it
made no sense, and will welcome the end of one small annoyance in ITK.



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-developers mailing list