Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: *&aptr , &*aptr question |
| Date | 2016-06-15 00:14 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87twgvxt19.fsf@bsb.me.uk> (permalink) |
| References | (1 earlier) <12ba4330-5009-077d-83d8-3e41a7221f7f@verizon.net> <njpul4$eiv$1@dont-email.me> <81f2561c-bea5-4846-9d10-9862764110ef@googlegroups.com> <lvalue-20160614232823@ram.dialup.fu-berlin.de> <njq1ud$sam$1@dont-email.me> |
BartC <bc@freeuk.com> writes: > On 14/06/2016 23:28, Stefan Ram wrote: >> jameskuyper@verizon.net writes: >>> I can confirm that gcc gives the message "error: lvalue >>> required as unary & operand" for & &*Ptr. This >>> seems to me to be clearly in conflict with the specification: >>> "the result [of &*] is as if both were omitted". I'd consider >>> this a defect in gcc. >> >> »& &*Ptr« is not allowed because »the result is not an >> lvalue« (6.5.3.1p3). »&*Ptr« is not an lvalue, but the >> first »&« in »&*Ptr« requires an lvalue. >> > > What's going on here then: > > int* Ptr; > > Ptr = Ptr; > Ptr = *Ptr; That's a constraint violation (assigning an int to a pointer). > Ptr = &Ptr; Ditto (assigning a pointer of the wrong type). > Ptr = &*Ptr; > Ptr = *&Ptr; > > Ptr = &*&Ptr; Ditto (assigning a pointer of the wrong type). > Ptr = *&*Ptr; Ditto (assigning an int to a pointer). > Ptr = &*&*Ptr; > Ptr = *&*&Ptr; The others are OK (though not necessarily reasonable code). > These are all fine according to gcc (and TCC and clang; other > compilers aren't quite so happy). For me, gcc gives a diagnostic (as it should) for all of those that are constraint violations, even with no options. But that's quite a modern gcc. You might need to ask gcc to compile actual C rather that it's almost C-like default language. -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
*&aptr , &*aptr question G G <gdotone@gmail.com> - 2016-06-14 13:43 -0700
Re: *&aptr , &*aptr question Richard Heathfield <rjh@cpax.org.uk> - 2016-06-14 22:01 +0100
Re: *&aptr , &*aptr question Ike Naar <ike@iceland.freeshell.org> - 2016-06-14 21:20 +0000
Re: *&aptr , &*aptr question G G <gdotone@gmail.com> - 2016-06-14 14:38 -0700
Re: *&aptr , &*aptr question Richard Heathfield <rjh@cpax.org.uk> - 2016-06-14 22:42 +0100
Re: *&aptr , &*aptr question Ken Brody <kenbrody@spamcop.net> - 2016-06-15 14:22 -0400
Re: *&aptr , &*aptr question Richard Heathfield <rjh@cpax.org.uk> - 2016-06-15 19:24 +0100
Re: *&aptr , &*aptr question "James R. Kuyper" <jameskuyper@verizon.net> - 2016-06-14 17:17 -0400
Re: *&aptr , &*aptr question Keith Thompson <kst-u@mib.org> - 2016-06-14 14:37 -0700
Re: *&aptr , &*aptr question "James R. Kuyper" <jameskuyper@verizon.net> - 2016-06-14 17:40 -0400
Re: *&aptr , &*aptr question "James R. Kuyper" <jameskuyper@verizon.net> - 2016-06-14 17:49 -0400
Re: *&aptr , &*aptr question BartC <bc@freeuk.com> - 2016-06-14 22:57 +0100
Re: *&aptr , &*aptr question jameskuyper@verizon.net - 2016-06-14 15:22 -0700
Re: *&aptr , &*aptr question "James R. Kuyper" <jameskuyper@verizon.net> - 2016-06-14 18:40 -0400
Re: *&aptr , &*aptr question BartC <bc@freeuk.com> - 2016-06-14 23:44 +0100
Re: *&aptr , &*aptr question BartC <bc@freeuk.com> - 2016-06-14 23:54 +0100
Re: *&aptr , &*aptr question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-15 00:14 +0100
Re: *&aptr , &*aptr question Keith Thompson <kst-u@mib.org> - 2016-06-14 16:51 -0700
Re: *&aptr , &*aptr question BartC <bc@freeuk.com> - 2016-06-15 01:15 +0100
Re: *&aptr , &*aptr question Keith Thompson <kst-u@mib.org> - 2016-06-14 17:44 -0700
Re: *&aptr , &*aptr question David Brown <david.brown@hesbynett.no> - 2016-06-15 09:12 +0200
Re: *&aptr , &*aptr question Richard Heathfield <rjh@cpax.org.uk> - 2016-06-15 08:28 +0100
Re: *&aptr , &*aptr question David Brown <david.brown@hesbynett.no> - 2016-06-15 10:26 +0200
Re: *&aptr , &*aptr question Richard Heathfield <rjh@cpax.org.uk> - 2016-06-15 09:48 +0100
Re: *&aptr , &*aptr question BartC <bc@freeuk.com> - 2016-06-15 11:05 +0100
Re: *&aptr , &*aptr question David Brown <david.brown@hesbynett.no> - 2016-06-15 12:22 +0200
Re: *&aptr , &*aptr question Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-06-15 03:55 -0700
Re: *&aptr , &*aptr question David Brown <david.brown@hesbynett.no> - 2016-06-15 13:15 +0200
Re: *&aptr , &*aptr question BartC <bc@freeuk.com> - 2016-06-15 13:08 +0100
Re: *&aptr , &*aptr question David Brown <david.brown@hesbynett.no> - 2016-06-15 14:15 +0200
Re: *&aptr , &*aptr question BartC <bc@freeuk.com> - 2016-06-15 14:02 +0100
Re: *&aptr , &*aptr question Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-06-15 13:38 -0700
Re: *&aptr , &*aptr question David Brown <david.brown@hesbynett.no> - 2016-06-16 00:01 +0200
Re: *&aptr , &*aptr question Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-06-16 00:58 -0700
Re: *&aptr , &*aptr question supercat@casperkitty.com - 2016-06-15 09:06 -0700
Re: *&aptr , &*aptr question BartC <bc@freeuk.com> - 2016-06-15 17:54 +0100
Re: *&aptr , &*aptr question raltbos@xs4all.nl (Richard Bos) - 2016-06-15 20:10 +0000
Re: *&aptr , &*aptr question supercat@casperkitty.com - 2016-06-14 16:28 -0700
Re: *&aptr , &*aptr question Keith Thompson <kst-u@mib.org> - 2016-06-14 16:54 -0700
Re: *&aptr , &*aptr question supercat@casperkitty.com - 2016-06-14 19:13 -0700
Re: *&aptr , &*aptr question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-15 13:19 +0100
Re: *&aptr , &*aptr question Tim Rentsch <txr@alumni.caltech.edu> - 2016-06-16 10:39 -0700
Re: *&aptr , &*aptr question supercat@casperkitty.com - 2016-06-16 12:06 -0700
Re: *&aptr , &*aptr question Tim Rentsch <txr@alumni.caltech.edu> - 2016-06-21 12:21 -0700
Re: *&aptr , &*aptr question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-16 21:06 +0100
Re: *&aptr , &*aptr question supercat@casperkitty.com - 2016-06-16 14:35 -0700
Re: *&aptr , &*aptr question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-17 01:22 +0100
Re: *&aptr , &*aptr question Tim Rentsch <txr@alumni.caltech.edu> - 2016-06-16 22:21 -0700
Re: *&aptr , &*aptr question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-18 00:55 +0100
Re: *&aptr , &*aptr question supercat@casperkitty.com - 2016-06-17 17:26 -0700
Re: *&aptr , &*aptr question Tim Rentsch <txr@alumni.caltech.edu> - 2016-06-21 12:19 -0700
Re: *&aptr , &*aptr question supercat@casperkitty.com - 2016-06-21 13:09 -0700
Re: *&aptr , &*aptr question Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-14 22:30 -0400
Re: *&aptr , &*aptr question Tim Rentsch <txr@alumni.caltech.edu> - 2016-06-15 14:20 -0700
csiph-web