Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/20/03 20:26
Read: times


 
#56972 - RE: SDCC: Unions inside structs
Responding to: ???'s previous message
"So there's the problem -- improper use of the 'data' keyword."

Yep, that would certainly be my first guess.

However, I'm suprised that you only got the syntax error in main(), rather than in definition of the structure; using the 'pre' and '/pre' HTML tags to make it legible:
struct 
{ 
   char data_id; 
   union 
   { 
      char c; 
      int i; 
   } data; // is 'data' allowed here??
} message; 

void main (void) 
{ 
... 
message.data_id = 0; // This works 
message.data.c = 0;  // => Syntax error (It doesn't compile) 
... 
}
Or have we not quite been told the whole story?

List of 7 messages in thread
TopicAuthorDate
SDCC: Unions inside structs            01/01/70 00:00      
   RE: SDCC: Unions inside structs            01/01/70 00:00      
   RE: SDCC: Unions inside structs            01/01/70 00:00      
      RE: SDCC: Unions inside structs            01/01/70 00:00      
      RE: SDCC: Unions inside structs            01/01/70 00:00      
         Extensions            01/01/70 00:00      
         RE: SDCC: Unions inside structs            01/01/70 00:00      

Back to Subject List