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,085 of 33,346    |
|    Edward Rosten to James K. Lowden    |
|    Re: compilers, endianness and padding    |
|    24 May 13 11:00:41    |
   
   From: firstname.dot.lastname@googlemail.com   
      
   On Wed, 22 May 2013 22:41:50 -0700, James K. Lowden wrote:   
      
   > 2. Discarded by the compiler today:   
   > nameof(d) == "d"   
   > extentof(d) == sizeof(double)   
      
   That's the bit I'm not sure does work. If, for instance d* is passed to a   
   separate translation unit before serialisation, the compiler can't tell   
   whether d is pointing to an individual double or an array of doubles.   
      
   At this point there's little choice but to serialise the entire allocated   
   block that d points into.   
      
   Though, the serialisation can be done naively, since clearly it cannot   
   contain anything other than doubles that would need to be valid on the   
   other end.   
      
   I'm not actually 100% sure about that last point. If you can legitimately   
   construct a pointer to a   
      
   struct NotSure{   
    double first_member;   
    //other stuff   
   };   
      
      
   from a pointer to a double then you can't even assume that the only data   
   pointed to is doubles. I can't remember if this is legal in C++ off hand.   
      
   -Ed   
      
      
   --   
    [ 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