On Sat, Feb 23, 2002 at 02:50:22PM +0300, Alexander Horoshilov wrote:
> >
> > Let's say p is a pointer to a _record. The compiler requires knowledge
> > of the size of the object pointed to by p (in order to support
> > operations such as p++, or declaring an instance of _record on the
> > stack, etc.). It does not matter whether or not you actually perform
> > such an operation anywhere in the code, the compiler still needs to know
> > the size of _record. Since BitmapType is a incomplete structure definition,
> > the size of _record is unknown, and so the compiler is warning you about
that.
>
> No, standard C++ compiler *should not* know the size of the object or
> the structure in order to declare the pointer to its instance, only its
> *existence*. For example, following code should be compiled by any
> ANSI/ISO C++ compiler (actually, I don't know if CW compiles this, since
> I don't use it):
Sure, and this works also in C, not only C++.
Declaring a pointer to an unknown structure is a technique fundamental
to information hiding in C.
Too often poor coded interfaces expose data structure when not
necessary (perhaps because of the ignorance of this simple language
feature).
Ciao,
Marco
--
========================================================================
Marco Pantaleoni panta@...
Padova, Italy panta@...
elastiC language developer http://www.elasticworld.org
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/tech/support/forums/