[Insight-developers] type issues in itkPriorityQueueTest

Luis Ibanez luis.ibanez at kitware.com
Thu Jan 20 14:13:32 EST 2011


Hi Arnaud,

Does it really make sense to use a -1
as return code for an identifier ?

It is that for an error condition ?

or for indicating that an element has not been found ?

If this is a non-found situation,
then we probably should define an error code,
such as

const IdentifierType  ELEMENT_NOT_FOUND =
   itk::NumericTraits<IdentifierType>::max();

and then use this symbol for the error checking,
such as

   if( ElementId != ELEMENT_NOT_FOUND )
    {....


On the other hand, if this is really an error condition,
then we should be throwing an Exception.


  My 2 cents,


       Luis


--------------------------------------------------------------------------------------
On Thu, Jan 20, 2011 at 10:38 AM, Arnaud GELAS
<arnaud_gelas at hms.harvard.edu> wrote:
> Hi Luis,
>
> In 811aef1f, you have changed the identifier type in itkPriorityQueueTest
> from int to itk::IdentifierType (which is an unsigned one).
>
> The current test which is not complete does not test the method Update(
> element ) where one identifier is compared to -1 (line 320), so with such a
> type the test would always fail...
>
> I am now right working on improving the test to test this method.
>
> Should we ensure ElementIdentifier to be signed with some concept checking
> or should the comparison be done on cast version of -1 ?
>
> Thanks,
> Arnaud
>


More information about the Insight-developers mailing list