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

Back to Subject List

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


 
#43926 - RE: Universal casting to structs/union/void
Responding to: ???'s previous message
#define CAST(new_type,old_object) (*((new_type *)&old_object))
...
found on the internet used in a linux project ...


Intuitively, you would expect a compiler to resolve this down to some form of direct addressing -- and most compilers do just that. I have run across compilers that generate code to access the data objects using indirect addressing, so if you have any concerns about performance, it's best to check the compiler-generated code for this. But then, if one was concerned about performance, one would be writing in assembly anyway, right?

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