home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / wdj0796.zip / NELSON.ZIP / FIGURE1.TXT < prev   
Text File  |  1996-04-09  |  910b  |  33 lines

  1. Output from BUG0796.CPP:
  2.  
  3. Even though A has no data members, it
  4. still has to occupy a minimum of one
  5. byte according to the C++ standard.
  6. Class B has a single pointer, so under a
  7. 32 bit programming model, it should be
  8. exactly four bytes larger.
  9. Unfortunately, VC++ forgets to add that
  10. extra byte from the base class:
  11.  
  12. sizeof( A ) = 1  sizeof( B ) = 4
  13.  
  14. As the two constructors are called, note
  15. the addresses of the two memory buffers
  16. that have been allocated for the names
  17. of the objects:
  18.  
  19. in ctor p = 0x00650540, name = object b1
  20. in ctor p = 0x00650648, name = object b2
  21.  
  22. When the assignment operator is
  23. invoked, the buffer values for this and
  24. that should match what you see printed
  25. out from the constructors:
  26.  
  27. buffer::operator=( that ) that.p  = 0x00650540, object b1
  28.                           this->p = 0x00650640,
  29.  
  30. Since the pointer has been mangled,
  31. expect a GPF upon exit!
  32.  
  33.