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

  1. Xref: sparky comp.std.c++:1943 comp.std.c:3307
  2. Newsgroups: comp.std.c++,comp.std.c
  3. Path: sparky!uunet!munnari.oz.au!metro!sequoia!state.COM.AU!bart!jamesc
  4. From: jamesc@swapsdev.state.state.COM.AU (James Cribb)
  5. Subject: Re: Question about sizeof in C/C++.
  6. Message-ID: <jamesc.725854759@bart>
  7. Sender: news@state.COM.AU
  8. Organization: Group Treasury, State Bank of NSW
  9. References: <jamesc.724544278@bart> <wwJXVB3w164w@amfent.Gwinnett.COM> <1992Dec24.001540.30000@microsoft.com>
  10. Date:  1 Jan 93 02:19:19 GMT
  11. Lines: 15
  12.  
  13. jimad@microsoft.com (Jim Adcock) writes:
  14. >jamesc@swapsdev.state.state.COM.AU (James Cribb) writes:
  15. >| Given
  16. >|     struct Something*  ps;
  17. >|     unsigned  k;
  18. >| do the C or C++ standards guarantee that
  19. >|     &ps[k] == ((char*) ps) + k * sizeof(struct Something)
  20. >
  21. >No.  The relationship holds only if ... k is less than or equal 
  22. >to the number of elements in the array pointed-to by ps
  23.  
  24. My code meets those conditions, but just out of interest,
  25. if k is too big, what could cause an inequality (of the addresses)?
  26.  
  27.     j.c
  28.