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