Topic: sizeof operator for a class


Author: wfrankli@interserv.com (Wayne Franklin)
Date: 1995/04/03
Raw View
I'm having great difficulty with the use of the sizeof operator
on a class.  I've got a class with a constructor, destructor, and
some public data items (one of which is a known-length array).

I need a #define for its length (to alloate the proper sized
chunk of shared memory), and am trying to use the sizeof
operator:

#define CLASS_SIZE sizeof( Class )

The compiler (Watcom 9.52 for QNX 4.22) keeps issuing
a warning stating the sizeof requires compiler generated info.
It'll compile anyway (with what size?), but I cannot seem
to make the warning go away.  I've tried commenting out
several pieces of the class def (the functions, the array, etc.),
but it doesn't change anything.  Everything is public, so
it doesn't seem to be a scoping problem.  I'm fresh out of
ideas.

Please help!  :-(

Thanks in advance!
Wayne Franklin