[Insight-developers] Why is m_NumberOfThreads signed?

M.Staring at lumc.nl M.Staring at lumc.nl
Mon May 16 10:38:11 EDT 2011


I agree with David.


-          There is already an impact on users when switching to ITK4. This is just a small addition.

-          Yes, when you are using int you get a warning, but it's a good warning! It warns that you may use a negative number for something that is never negative.

For me ITK4 is the chance to do things the right way, also for these smaller nuisances. Otherwise we are stuck with it for the coming years.

Note that the recently refactored ImageToImageMetric does use unsigned int for the number of threads.

Cheers,

Marius



From: Bill Lorensen [mailto:bill.lorensen at gmail.com]
Sent: maandag 16 mei 2011 15:17
To: Bradley Lowekamp
Cc: David Doria; Insight Developers; Luis Ibanez; Staring, M. (LKEB)
Subject: Re: [Insight-developers] Why is m_NumberOfThreads signed?

I agree with Brad. Also, in customers' applications, they have been using int and they will have to change their code. Further it will be difficult to build an application against both ITK3 and ITK4 without #ifdef's. For example, Slicer4 currently builds against ITK3 and ITK4.

It seems the benefit ("it makes more sense") is small compared to the possible impact on our customers.

Bill
On Mon, May 16, 2011 at 9:04 AM, Bradley Lowekamp <blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>> wrote:
But then all the people who just used int, would get a warning. I don't see an advantage.


On May 16, 2011, at 8:41 AM, David Doria wrote:


On Mon, May 16, 2011 at 8:38 AM, Bradley Lowekamp
<blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>> wrote:

What is the motivation for changing this? Why is unsigned better the signed?

It came to my attention because I would do something like:

for(unsigned int i = 0; i < this->m_NumberOfThreads; ++i)

and get warnings about unsigned/signed comparisons.

Also, it just seems more "correct", as it doesn't make sense for the
number of threads to be negative.

David


========================================================

Bradley Lowekamp

Lockheed Martin Contractor for

Office of High Performance Computing and Communications

National Library of Medicine

blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>



_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.html

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110516/f47b6608/attachment.htm>


More information about the Insight-developers mailing list