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 33,022 of 33,346   
   Jack Adrian Zappa to All   
   Re: compilers, endianness and padding   
   08 May 13 14:23:55   
   
   b0ddccf7   
   30369759   
   From: adrianh.bsc@googlemail.com   
      
   On May 8, 8:23 am, Joshua Maurice    
   wrote:   
   > I'm sorry. I'm confused and lost. Exactly what functionality do you   
   > think you want? Can you give a specific example please?   
      
   I'm thinking about interoperability between compilers and platforms.   
   Streaming/storing data to be interpreted by another computer on   
   another system.   
      
   Currently we have things like htons(), htonl(), ntohs() and ntohl(),   
   which are fairly primitive and are dependent on macros located off of   
   a non standard header file(s), usually starting with the header file   
   endian.h.  This is the best we have at the current moment.   
      
   By making endianness into a modifier, (and perhaps other attributes   
   like bit size as well), this can allow the compiler to deal with the   
   low level details, optimizing the system to the best of its ability.   
   After all, the compiler knows what size and endianness the base type   
   it's native system it is compiling to.  And with strict aliasing   
   coming about, trying to determine such things is going to be harder if   
   not impossible.  Also, it is currently not possible (across compilers)   
   to determine this at compile time anyway (hence the endian.h header   
   file, which is architecture specific and is not on all systems).   
      
      
   A   
      
      
   --   
         [ 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