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,083 of 33,346    |
|    Edward Rosten to Joshua Maurice    |
|    Re: compilers, endianness and padding    |
|    24 May 13 06:28:45    |
      b8bf9f0c       From: firstname.dot.lastname@googlemail.com              On Wed, 22 May 2013 22:38:23 -0700, Joshua Maurice wrote:              > Actually, no. Suppose you ask for an array of double:       > new double[7];       > It's my understanding that a lot of heap implementations will not       > return you /exactly/ an array of 7 doubles. It'll actually return to       > you an array of 8 doubles. Nowhere will it track that it allocated       > exactly 7. Instead, it keeps track that it gave you 8 or less, and       > it doesn't care beyond that. It's actually quite possible for arrays       > of POD types to not contain the actual size at all. It's sometimes       > more efficient to not contain the exact size and instead round up to       > multiples of 2 to use a small number of separate pools.              Presumably, though that would not matter for these purposes. In this       case, the serialiser would write out a bit more data than is required,       and then load it in on the other end. That data would contain junk       which would be dutifully saved and reloaded, but it wouldn't then be       used by the program.              Of course, (de)serialising junk is a waste of bandwidth and storage,       so it wouldn't be ideal, but I don't see that it would be too much of       a problem otherwise.                     -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