[vtk-developers] Handling invalid vtp files

David Gobbi david.gobbi at gmail.com
Sun Feb 14 11:07:14 EST 2010


I'm with Francois and Berk.  The checks should go in the reader, and
they shouldn't be optional.

Checking for valid data later in the pipeline should be considered a
separate issue.

    David


On Sun, Feb 14, 2010 at 8:47 AM, Francois Bertel
<francois.bertel at kitware.com> wrote:
> Asserts are for programming errors ONLY. Assert check if a programming
> is valid, bug free. It is just a very basic way in C++ to implement
> Programming by Contract
> http://en.wikipedia.org/wiki/Design_by_contract (check of
> pre/post-conditions and invariants).
>
>
> They are NOT for checking the validity of the incoming data a program
> is loading or receiving. A program has to be robust regarding the
> input data (a file can be badly generated or can be corrupted because
> of a faulty block on a disk or an error in a remote connexion).
>
>
>
> On Sun, Feb 14, 2010 at 8:58 AM, Karthik Krishnan
> <karthik.krishnan at kitware.com> wrote:
>> On Sat, Feb 13, 2010 at 6:18 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
>>> to something like:
>>> template <class T>
>>> void vtkDataArrayTemplate<T>::GetTuple(vtkIdType i, double* tuple)
>>> {
>>>   T* t = this->Array + this->NumberOfComponents*i;
>>>   if(!t)
>>>     {
>>>     return;
>>>     }
>>
>> You could change that to : assert(t != NULL)
>>
>> I think the VTK community would okay assert's. They compile only when
>> _DEBUG is defined; ie no overhead in the release version. That said,
>> Berk is right, that in this case it doesn't provide very useful
>> information..
>>
>> Mimicking some of boost's compile time and static assertion's might be
>> good for VTK, to enable bounds checking and traits validity even in
>> performance critical code.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>
>
>
> --
> François Bertel, PhD  | Kitware Inc. Suite 204
> 1 (518) 371 3971 x113 | 28 Corporate Drive
>                      | Clifton Park NY 12065, USA
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>



More information about the vtk-developers mailing list