home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / cplus / 1897 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  1.9 KB

  1. Path: sparky!uunet!tdat!tools3!swf
  2. From: swf@tools3teradata.com (Stan Friesen)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1660@tdat.teradata.COM>
  6. Date: 22 Dec 92 21:48:33 GMT
  7. References: <1992Dec9.075125.22405@lth.se> <1992Dec12.154918.2220@ucc.su.OZ.AU> <1992Dec14.225659.24225@microsoft.com> <1992Dec16.150144.6004@ucc.su.OZ.AU>
  8. Sender: news@tdat.teradata.COM
  9. Distribution: world
  10. Organization: NCR Teradata Database Business Unit
  11. Lines: 35
  12.  
  13. In article <1992Dec16.150144.6004@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  14. |>     In that case it is implementable on all systems
  15. |>     where (opinion follows, please correct errors)
  16. |> 
  17. |>     a) void* is big enough to hold all pointer types
  18.  
  19. This assumption, as written, is violated by compact and medium model on Intel
  20. chips.  I suggest rewording this to:
  21.     a) void* is big enough to hold all object pointer types
  22.                        ^^^^^^
  23. [function pointers are *not* guarenteed to be convertable to void *, and,
  24. in C++, neither are member 'pointers'].
  25.  
  26. |>     b) conversions always pad systematically
  27. |>     c) bitwise comparison is done 
  28. |>     d) the bits of a pointer cannot be magically changed by the system
  29. |>     e) a pointer is implemented as an object in contiguous storage
  30. |> ...
  31. |> 
  32. |>     Certainly, (e) might cause problems on the 80x86 where part of the
  33. |> pointer is implicit and not physically stored. Does it *actually*
  34. |> cause this problem?
  35.  
  36. In 'small data' models, YES!  There is simply no reason for void* to contain
  37. the segment when all data is in the same segment.
  38.  
  39. Of course, in paractice, the limitations on the 'small data' models make this lack
  40. of little *practical* concern for ptrcmp() - that is since all data are in the
  41. same segment a segmentless comparison will always work (as long as you use the
  42. *stronger* form of (a) I mention above).
  43.  
  44. -- 
  45. sarima@teradata.com            (formerly tdatirv!sarima)
  46.   or
  47. Stanley.Friesen@ElSegundoCA.ncr.com
  48.