[vtk-developers] Re: [vtkusers] Unconnected filter(s) causing seg faults
Charl P. Botha
c.p.botha at ewi.tudelft.nl
Thu Oct 16 11:34:06 EDT 2003
Mathieu Malaterre wrote:
> Charl P. Botha wrote:
>> N Smethurst wrote:
>>> How should the checks be implemented? I noticed that in the methods
>>> that do check, some do this
>>>
>>> if (input == NULL)
>>> {
>>> vtkErrorMacro(<<"Input is NULL");
>>> return;
>>> }
>>>
>>> whilst others just do a
>>> if (input == NULL)
>>> {
>>> return;
>>> }
>> Personally I prefer the first form. At the very least we should keep
>> the error message consistent so that it can be filtered if the
>> programmer requires that.
>
>
> One day ago, the second form was prefered:
> http://vtk.org/cgi-bin/cvsweb.cgi/VTK/Graphics/vtkMaskPoints.cxx.diff?r1=1.41&r2=1.42
>
>
> I guess sometime it can happen to have an empty input. So there is no
> reason to produce an error.
>
> I'll go for the second form, or a vtkWarningMacro instead.
The diff you refer to wasn't checking for GetInput() like the examples
Nick has found. I agree though, sometimes having no input is not an
error, but the user should definitely be notified as this can be the
source of many program errors.
I do like your suggestion of vtkWarningMacro as a compromise.
--
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/
More information about the vtk-developers
mailing list