home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,603 of 33,346   
   fmatthew5876 to All   
   Strict aliasing and marshalling   
   24 Oct 12 11:44:15   
   
   From: fmatthew5876@googlemail.com   
      
   With strict aliasing enabled, what is the most correct way   
   to marshal/unmarshal binarydata?   
      
   unsigned char* buffer   
   uint32_t v32   
      
   Would you use one of these?   
   memcpy(&v32, buffer, sizeof(v32))   
   v32 = *((uint32_t*)(buffer)) //unaligned reads??   
      
   Would you do something else?   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca