From: jklowden@speakeasy.net   
      
   On Mon, 13 May 2013 06:28:28 CST   
   Francis Glassborow wrote:   
      
   > > has been, as you well know, defined in namespace std for 25 years.   
   > >   
   > > Why do people think pointers can't be serialized?   
   >   
   > Perhaps I am confused (quite likely :) but surely serialisation is   
   > not just the ability to output data but the ability to read it back   
   > in a meaningful way. On most systems the value of a pointer (i.e. an   
   > address) is specific to the current run. If it is on the stack it   
   > only survives as long as the stack has not been unwound past that   
   > point, and if it is on the heap it only survives until that   
   > allocation has been released. To put it more simply, a pointer only   
   > survives until the memory for the relevant object has been released.   
      
   Maybe we don't mean the same thing. To me, "serialize a pointer" is   
   the same as "marshal the data". On output, chase the pointer and   
   write the data. On input, allocate the memory, assign the pointer,   
   and fill the buffer.   
      
   The value of the pointer itself is immaterial. Indeed, the value of   
   the pointer in *memory* is immaterial, right? We don't usually care   
   what the numeric value of a pointer is -- we don't even care that's   
   it's a number -- but only that it can be dereferenced to get at the   
   pointed-at value.   
      
   --jkl   
      
      
   --   
    [ 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)   
|