[vtk-developers] vtkImageData

Charl P. Botha c.p.botha at its.tudelft.nl
Tue Jun 5 11:34:25 EDT 2001

On Tue, Jun 05, 2001 at 08:57:48AM -0400, Jeff Lee wrote:
> prototypes(interface) and their corresponding implementation.  One
> example is vtkImageData::GetDimensions(...).  The interface expects the
> argument to be an integer array, and the implementation expects an
> int*.  It is a mystery to me as to why other compilers don't complain
> about this (probably an acceptable built-in conversion for most
> compilers).  Anyhow, I think that it is good programming practice to
> make the prototype match the implementation.  In the case of

This is (afaik) _entirely_ acceptable.  In the case of "int a[3]", a is also
a pointer to the first element of the array, thus of type "int *".  From my
ISO C++ spec, page 58:

4.2 Array-to-pointer conversion 
1 An lvalue or rvalue of type array of N T or array of unknown bound of T
can be converted to an rvalue of type pointer to T.  The result is a pointer
to the first element of the array.

Does your compiler claim ISO compliance?

charl p. botha      | computer graphics and cad/cam 
http://cpbotha.net/ | http://www.cg.its.tudelft.nl/

More information about the vtk-developers mailing list