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 16:16
Read: times


 
#56958 - RE: SDCC: Unions inside structs
Responding to: ???'s previous message
I do not know SDCC and its limitations but I think I would define the union outside the structure. In the structure just put an "int data" member. (((Do check whether it is legal to be using the word "data" as a variable name because it is often a reserved keyword.))).

Then to place a "c" data item into the structure you could use casts like this.

union chr_int {
char c;
int i;
};

struct {
char data_id;
int data;
} message;

...
...

(union chr_int *)&message.data -> c = 0;


Try that or something like it.
Michael Karas


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