possible VMS C initialization bug
steve emmerson
steve at umigw.MIAMI.EDU
Tue Feb 7 00:56:58 AEST 1989
I've run into a possible VMS C compiler bug (version 2.4-026). The
following code fragment (which is located at the head of a compilation
unit) won't compile:
typedef struct {
int member_1;
float member_2;
} BIG_S;
BIG_S BigStruct = {1, 2.};
typedef struct {
int member;
} LITTLE_S;
int *iptr = &((LITTLE_S*)&BigStruct)->member;
Instead, the compiler emits the error message "The initialization of iptr is
invalid" at the "*iptr =" line.
Conversely, the above fragment does compile (and run) under both my
EUNICE C compiler and my VMS GNU C compiler.
Question: is the above a bug?
--
Steve Emmerson Inet: steve at umigw.miami.edu [128.116.10.1]
SPAN: miami::emmerson (host 3074::) emmerson%miami.span at star.stanford.edu
UUCP: ...!ncar!umigw!steve emmerson%miami.span at vlsi.jpl.nasa.gov
"Computers are like God in the Old Testament: lots of rules and no mercy"
More information about the Comp.lang.c
mailing list