BUG: Internal Compiler Error: MSC1.CPP, Line 585 or 581Last reviewed: July 22, 1997Article ID: Q113112 |
1.00 1.50
WINDOWS
kbtool kbbuglist
The information in this article applies to:
SYMPTOMSCompiling the sample code shown below causes the compiler to incorrectly generate one of the following error messages:
fatal error C1001 : internal compiler error ( compiler file 'msc1.cpp', line 585 ) -or- fatal error C1001 : internal compiler error ( compiler file 'msc1.cpp', line 581 ) CAUSEPartially initializing an array of structures that is a field of another structure (referred to as an "aggregate") causes the compiler to generate internal compiler errors. The compiler does not generate an error if using a .C file. The example shown below illustrates this:
typedef struct Element { int field1; char *field2; } ELEMENT; typedef struct Aggregate { ELEMENT list[5]; } AGGREGATE;Defining and initializing a variable using:
AGGREGATE mylist = { 1, "one", 2, "two", 3, "three", 4, "four" }; // Internal compiler error C1001. RESOLUTIONThere are three workarounds to this problem:
STATUSMicrosoft has confirmed this to be a problem with C/C++ versions 8.0 and 8.0c. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. This is not a problem in Visual C++ 32-bit Edition.
MORE INFORMATIONIn C++, when an aggregate is initialized, the initializer is a list of brace-enclosed, comma-separated initializers for the members of the aggregate in increasing sequence or member order. This rule applies recursively to the members of the subaggregates if there are any. If fewer initializers are in the list than the members of the aggregate, then the remaining members are padded with zeroes of the appropriate types.
Sample Code
/* Compile options needed: /c */typedef struct Element { int field1; char *field2;} ELEMENT; typedef struct Aggregate { ELEMENT list[5];} AGGREGATE;
void main(void){ AGGREGATE mylist = { 1, "one" , 2, "two" , 3, "three" , 4, "four" }; } |
Additional reference words: 1.00 1.50 8.00 8.00c
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |