This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Re: enum xyz;
- To: jtc@redback.com
- Subject: Re: enum xyz;
- From: Stan Shebs <shebs@cygnus.com>
- Date: Mon, 9 Aug 1999 14:57:33 -0700
- CC: gdb@sourceware.cygnus.com
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