| Compiling:
#include <prcdef.h>
union prcdef q_stsflg;
void main (void) {
q_stsflg.prc$r_prcdef_bits.prc$v_detach = 1;
}
/preprocess_only I get the follow (some parts removed)
#pragma nostandard
union prcdef {
variant_struct {
...
unsigned prc$v_detach : 1;
...
} prc$r_prcdef_bits;
variant_struct {
unsigned prc$v_fill_0 : 6;
unsigned prc$v_login : 1;
unsigned prc$v_fill_60 : 1;
} prc$r_prcdef_obsolete;
} ;
union prcdef q_stsflg;
void main (void) {
q_stsflg.prc$r_prcdef_bits.prc$v_detach = 1;
}
prc$r_prcdef_bits is a variant_struct, not a struct. Because
prc$r_prcdef_bits is a variant_struct, you do not mention it when
referencing its fields. That is, you use
q_stsflg.prc$v_detach
and not
q_stsflg.prc$r_prcdef_bits.prc$v_detach
------
If you modified your test program to use variant_struct instead of struct
for old_fish, you would get a
%CC-W-VARIANTEXT, variant struct or union is a language extension.
diagnostic if you compiled in a standard conforming mode of the compiler.
You would not get the diagnostic if you used /standard=vaxc. PRCFAULT.C
does not get this diagnostic because of the
#pragma nostandard
in <prcdef.h>. This pragma tells the compiler that there is odd stuff
coming and to not complain about it.
August G. Reinig
|
| Assuming non-VAXC mode, there are a bunch of lines in prcdef.h of the form:
#define prc$v_detach prc$r_prcdef_bits.prc$v_detach
These defines are an attempt to hide the intermediate structures created by
SDL. You are expected to reference the fields as August indicated:
q_stsflg.prc$v_detach = 1;
Not q_stsflg.prc$r_prcdef_bits.prc$v_detach = 1;
Given the macro definition above, the latter expands to
q_stsflg.prc$r_prcdef_bits.prc$r_prcdef_bits.prc$v_detach = 1;
which leads to the error you saw.
Be careful using these structure fields in macro invocations, by the way.
Because the field name matches the macro, the field name might get expanded a
second time, leading to the same error.
(Some time back I tried to convince the SDL implementers to use uppercase for
the actual field and lowercase for the macro, avoiding the possibility of the
macro being expanded too many times, but nobody's taken me up on that one.)
Brian
|