[Insight-developers] Arbitrary use of exception specifications?

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Jun 29 10:42:10 EDT 2009


I made a partial list of where this is used:

blowek1$ grep throw\ \( */*.h
Algorithms/itkCompareHistogramImageToImageMetric.h:  void Initialize()  
throw (ExceptionObject);
Algorithms/itkCompareHistogramImageToImageMetric.h:  void  
FormTrainingHistogram() throw (ExceptionObject);
Algorithms/itkGradientDifferenceImageToImageMetric.h:  virtual void  
Initialize(void) throw ( ExceptionObject );
Algorithms/itkHistogramImageToImageMetric.h:  void Initialize() throw  
(ExceptionObject);
Algorithms/itkImageRegistrationMethod.h:  virtual void Initialize()  
throw (ExceptionObject);
Algorithms/itkImageToImageMetric.h:  virtual void Initialize(void)  
throw ( ExceptionObject );
Algorithms/itkImageToSpatialObjectMetric.h:  virtual void  
Initialize(void) throw (ExceptionObject);
Algorithms/itkImageToSpatialObjectRegistrationMethod.h:  void  
Initialize() throw (ExceptionObject);
Algorithms/itkKullbackLeiblerCompareHistogramImageToImageMetric.h:   
void Initialize() throw (ExceptionObject);
Algorithms/itkKullbackLeiblerCompareHistogramImageToImageMetric.h:   
void FormTrainingHistogram() throw (ExceptionObject);
Algorithms/itkMRIBiasFieldCorrectionFilter.h:    throw  
(ExceptionObject);
Algorithms/itkMRIBiasFieldCorrectionFilter.h:  void Initialize() throw  
(ExceptionObject);
Algorithms/itkMattesMutualInformationImageToImageMetric.h:  virtual  
void Initialize(void) throw ( ExceptionObject );
Algorithms/itkMultiResolutionImageRegistrationMethod.h:  void  
Initialize() throw (ExceptionObject);
Algorithms/itkPointSetToImageMetric.h:  virtual void Initialize(void)  
throw ( ExceptionObject );
Algorithms/itkPointSetToImageRegistrationMethod.h:  void Initialize()  
throw (ExceptionObject);
Algorithms/itkPointSetToPointSetMetric.h:  virtual void  
Initialize(void) throw ( ExceptionObject );
Algorithms/itkPointSetToPointSetRegistrationMethod.h:  void  
Initialize() throw (ExceptionObject);
Algorithms/itkShapePriorMAPCostFunction.h:  virtual void  
Initialize(void) throw ( ExceptionObject );
Algorithms/itkShapePriorMAPCostFunctionBase.h:  virtual void  
Initialize(void) throw ( ExceptionObject );
BasicFilters/itkBinaryMorphologyImageFilter.h:  void  
GenerateInputRequestedRegion() throw (InvalidRequestedRegionError);
BasicFilters/itkMaskNeighborhoodOperatorImageFilter.h:  void  
GenerateInputRequestedRegion() throw (InvalidRequestedRegionError);
BasicFilters/itkNeighborhoodOperatorImageFilter.h:  virtual void  
GenerateInputRequestedRegion() throw (InvalidRequestedRegionError);
BasicFilters/itkNormalizedCorrelationImageFilter.h:  void  
GenerateInputRequestedRegion() throw (InvalidRequestedRegionError);
BasicFilters/itkVectorNeighborhoodOperatorImageFilter.h:  virtual void  
GenerateInputRequestedRegion() throw (InvalidRequestedRegionError);
Common/itkDataObject.h:  virtual void PropagateRequestedRegion() throw  
(InvalidRequestedRegionError);
Common/itkImageAdaptor.h:  virtual void PropagateRequestedRegion()  
throw (InvalidRequestedRegionError);
Common/itkPCAShapeSignedDistanceFunction.h:  virtual void Initialize()  
throw ( ExceptionObject );
Common/itkShapeSignedDistanceFunction.h:  virtual void Initialize()  
throw ( ExceptionObject ) {};
Numerics/itkMultivariateLegendrePolynomial.h:    throw  
(CoefficientVectorSizeMismatch);
Numerics/itkMultivariateLegendrePolynomial.h:    throw  
(CoefficientVectorSizeMismatch);
Review/itkOptImageToImageMetric.h:  virtual void Initialize( void )  
throw ( ExceptionObject );
Review/itkOptImageToImageMetric.h:  virtual void  
MultiThreadingInitialize( void ) throw ( ExceptionObject );
Review/itkOptMattesMutualInformationImageToImageMetric.h:  virtual  
void Initialize(void) throw ( ExceptionObject );
Review/itkOptMeanSquaresImageToImageMetric.h:  virtual void  
Initialize(void) throw ( ExceptionObject );



On May 18, 2009, at 5:47 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote:

> Some methods in itk have what seem to be like abitrary use of  
> exception specifications such as:
>
> void DataObject::PropagateRequestedRegion() throw  
> (InvalidRequestedRegionError)
>
> I was adding an exception to  
> ImageFileReader::EnlargeOutputRequestedRegion, and then adding a  
> test to catch it. But my program was being terminated instead of  
> catching the exception. I should have known that this was what was  
> occurring, but it took me entirely too long to track down.
>
> Is there any reason for this behavior (explicit termination on  
> unspecified exception)?
> Is it desired that if an application encounters one of these  
> exceptions, it should immediately terminate? (just imagine using  
> something like slicer and this occurring)
> If it's desired should it be used more?
> should the exception specified methods just handle other exceptions?
>
>
> ========================================================
> Bradley Lowekamp
> Lockheed Martin Contractor for
> Office of High Performance Computing and Communications
> National Library of Medicine
> blowekamp at mail.nih.gov
>
>
> <ATT00001.txt>

========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov


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


More information about the Insight-developers mailing list