Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Wojtek Lerch <wojtek_l@yahoo.ca> |
|---|---|
| Newsgroups | comp.std.c |
| Subject | Re: C11 6.3.2.3p7 Referenced Type |
| Date | 2013-01-10 17:45 -0500 |
| Message-ID | <al8ujmFovdiU1@mid.individual.net> (permalink) |
| References | (2 earlier) <kfn1udxdbru.fsf@x-alumni2.alumni.caltech.edu> <akusqqFg0qhU1@mid.individual.net> <kcdj0t$g3v$1@dont-email.me> <akv3c8Fh7f0U1@mid.individual.net> <kcdpvu$adf$1@dont-email.me> |
On 07-Jan-13 1:29 AM, Shao Miller wrote: > On 1/7/2013 00:07, Wojtek Lerch wrote: >> In other words, does the standard guarantee that (char*)(int*)&x, if >> defined, must be equal to (char*)&x? > > (I think you meant to ask about '(char*)(int*)&f' and '(char*)&f', and > 'n' seems to have lost its relevance.) Actually I meant to ask generally, without necessarily referring to the code above -- substitute "(char*)(int*)&lval" and "(char*)&lval"... The only relevance of "n" was as a possible reference in "What if (int*)&lval points to some other object, let's call it 'n'?" > I think that example has the same consideration as the last one. If 'p' > (or '(int*)&f' can point to an object than than 'f', then '(char*)p' can > point to the lowest-addressed byte of that other object. But > '(float*)p' had better point to 'f' again. Right. But maybe it's a better example. > One way this might happen is if, for the values of 'int *' and 'float > *', pointers are simply indices, and '&f' means "the first float in the > program" and '&n' means "the first int in the program". 'char *' and > 'void *' (etc.) might have a greater range of meanings/values. > Eep. This would be scary. Sure; this doesn't sound like a practical rule that a sane implementation might reasonably want to apply to all programs. Typically for C, unions and pointers to allocated memory mess things up. But as far as I know, implementations aren't required to apply the same rules to all programs -- if a compiler only applies your index-based implementation of pointers only for programs that are simple enough to make it work, that's good enough as an example.
Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-04 02:08 -0500
Re: C11 6.3.2.3p7 Referenced Type Keith Thompson <kst-u@mib.org> - 2013-01-04 08:09 -0800
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-04 12:25 -0500
Re: C11 6.3.2.3p7 Referenced Type lawrence.jones@siemens.com - 2013-01-04 13:47 -0500
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-04 14:56 -0500
Re: C11 6.3.2.3p7 Referenced Type lawrence.jones@siemens.com - 2013-01-04 17:10 -0500
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-04 20:34 -0500
Re: C11 6.3.2.3p7 Referenced Type Wojtek Lerch <wojtek_l@yahoo.ca> - 2013-01-04 23:45 -0500
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-05 02:07 -0500
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-05 02:16 -0500
Re: C11 6.3.2.3p7 Referenced Type Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-06 17:25 -0800
Re: C11 6.3.2.3p7 Referenced Type Wojtek Lerch <wojtek_l@yahoo.ca> - 2013-01-06 22:13 -0500
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-06 23:30 -0500
Re: C11 6.3.2.3p7 Referenced Type Wojtek Lerch <wojtek_l@yahoo.ca> - 2013-01-07 00:07 -0500
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-07 01:29 -0500
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-07 02:18 -0500
Re: C11 6.3.2.3p7 Referenced Type Wojtek Lerch <wojtek_l@yahoo.ca> - 2013-01-10 17:45 -0500
Re: C11 6.3.2.3p7 Referenced Type Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-06 22:30 -0800
Re: C11 6.3.2.3p7 Referenced Type Shao Miller <sha0.miller@gmail.com> - 2013-01-07 01:58 -0500
Re: C11 6.3.2.3p7 Referenced Type Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-06 23:16 -0800
Re: C11 6.3.2.3p7 Referenced Type Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-06 22:02 -0800
csiph-web