enum xyz;

Stan Shebs shebs@cygnus.com
Mon Aug 9 14:58:00 GMT 1999


   From: jtc@redback.com (J.T. Conklin)
   Date: 09 Aug 1999 11:05:24 -0700

   One reason that may explain why incomplete enums are not permitted is
   the fact that a compiler is allowed to defer determining the storage
   size (and thus alignment) of an enum until it is defined.  Since the
   only thing you can do with an incomplete type is to use it to define 
   a pointer, an indeterminate storage size would lose on machines that
   have different pointer representations for different sized data 
   objects. 

Indeed, this is not a hypothetical issue; Apple's C compiler used to
make byte- and short-sized enums when it was possible to do so.  This
caused me much grief in porting GCC, since much of the code assumed
enums were int-sized.  I had to add many "rtx_dummy = 1000000" values
just to force the compiler to use an int representation.

We should probably lose the incomplete enum definitions in the
sources, because they are a portability problem, the problem can be
solved just by declaring affected functions after the enum's
definition in value.h, and there aren't very many incomplete enum in
the GDB sources.

								Stan


More information about the Gdb mailing list