Is this legal ANSI?

Kevin D. Quitt kdq at demott.com
Tue Jan 15 09:56:20 AEST 1991


    Microsoft C 6.0 accepts:

struct	master_log_entry
   {
    struct  log_entry	le;
    union
       {
        struct	gas_log_entry       gle;
        struct  status_log_entry    sle;
        struct  valve_log_entry     vle;
        struct  heat_log_entry      hle;
        struct  tool_log_entry      tle;
        struct  alarm_log_entry     ale;
       };
   };

struct master_log_entry	mle;


    then accepts references like:

	mle.gle.<reference to inside of gas_log_entry struct>

    and:

	&mle.gle


    without a complaint.  Am I just lucky?  gcc takes the definitions
(-ansi) but will not compile the code (i.e. `structure has no member named
"gle"').

    I really like being able to do that.  Anybody got the "Truth"?

-- 
 _
Kevin D. Quitt         demott!kdq   kdq at demott.com
DeMott Electronics Co. 14707 Keswick St.   Van Nuys, CA 91405-1266
VOICE (818) 988-4975   FAX (818) 997-1190  MODEM (818) 997-4496 PEP last



More information about the Comp.lang.c mailing list