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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/21/03 14:19
Read: times


 
#43852 - Universal casting to structs/union/void
Responding to: ???'s previous message
Maybe this will help ....

#define CAST(new_type,old_object) (*((new_type *)&old_object))



Example of CAST macro at work

union {
char ch[4];
int i[2];
} my_union;

long longvar;

longvar = (long)my_union; // Illegal cast
longvar = CAST(long, my_union); Legal cast


found on the internet used in a linux project ...


List of 12 messages in thread
TopicAuthorDate
Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
      RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
      RE: Pointers to Structure Elements            01/01/70 00:00      
         RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
   Universal casting to structs/union/void            01/01/70 00:00      
      RE: Universal casting to structs/union/void            01/01/70 00:00      

Back to Subject List