ID Number: Q67037
6.00 6.00a 6.00ax 7.00 | 6.00 6.00a
MS-DOS | OS/2
buglist6.00 buglist6.00a buglist6.00ax buglist7.00
Summary:
SYMPTOMS
The ability to use "nameless" structures and unions provides a
convenient shorthand for referring to structures embedded in other
structures, but the current design of the Microsoft C and QuickC
compilers does not allow these unnamed members to be initialized.
Permitting initialization involves a number of ambiguities that the
compiler does not currently track. If you attempt to initialize a
nameless structure or union, the C 6.x compiler will generate the
following error:
C2097 : illegal initialization
C/C++ version 7.0 will generate the following message:
C2078: too many initializers
STATUS
Microsoft has confirmed this to be a problem in C versions 6.0,
6.0a, 6.0ax, and 7.0 and QuickC versions 2.5 and 2.51 (buglist2.50
and buglist2.51). We are researching this problem and will post new
information here as it becomes available.
More Information:
The sample code below demonstrates this problem.
Sample Code
-----------
/* Compile options needed: none
*/
typedef struct _reg {
union {
long eax;
short ax;
};
union {
long ebx;
short bx;
};
} regtype;
regtype r1 = { {1l}, {2l} }; /* This initialization attempt
generates a C2097 error */
void main(void)
{
}
Additional reference words: 6.00 6.00a 6.00ax 7.00