Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: pointers Date: Wed, 26 Oct 2016 11:52:45 -0700 Organization: None to speak of Lines: 37 Message-ID: References: <18d7b7b9-ea72-49d3-9535-df13d560473c@googlegroups.com> <726d78eb-47b3-1b92-0203-e2f63bb740ae@verizon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="2e7171af2bda6d09a7fcdc04643cbc45"; logging-data="8426"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mTbPNHC8UW6VimIf5oM7F" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:0ggaxo1PQlIV+2gjMl7DL/xtOOc= sha1:bfCBMSotugD2kQQgwM5mNl4usNA= Xref: csiph.com comp.lang.c:95331 BartC writes: > On 26/10/2016 17:05, Keith Thompson wrote: >> BartC writes: > >>> & & &***p; // allowed on some compilers when p is T*** > >> No doubt the inability to write & & &***p has been a great >> inconvenience to you. > > What's the point of allowing &* and *&? I have an idea how that can > useful, but I'd be interested in hearing your take first. What would be the point of disallowing them? The semantics of the "&" operator are such that it can be applied to the result of a "*" operator, and vice versa. Expressions are built up from subexpressions in an arbitrary manner (subject to any constraints). I see no reason for the language to go out of its way to impose arbitrary restrictions. (Nor do I see any reason for it to to out of its way to make arbitrary nonsensical constructs valid.) It probably doesn't make much sense to write `- - - - - - - - 0`, but it would make even less sense for the language to go out of its way to disallow it. Any arbitrary restriction intended solely to prevent you from doing something silly is likely to prevent you from doing something useful. And to forestall your likely response, I do not consider the fact that the unary "&" operator does not yield an lvalue, or that it requires an lvalue as its operand, to be arbitrary; both rules are part of the fundamental semantics of the operator, and are applied consistently. [snip] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"