Article View: comp.lang.misc
Article #3882Re: postfix indirection operator in C
From: Chris Dollin
Date: Fri, 20 Nov 1992 10:12
Date: Fri, 20 Nov 1992 10:12
33 lines
2246 bytes
2246 bytes
In article ... hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
Certainly not from the standpoint of English speakers. As I understand it,
*x in C denotes the object referred to by x, the object "found" AT x. Thus,
@x would have been at least a somewhat logical notation, at least relatively
easily understood by users, as well as easy for parsing, etc.
The problem with having prefix indirection and postfix other things, namely,
field selection and subscripting, is that expressions such as
*x.y, *x[z]
become ambiguous; is the former ``*(x.y)'' or ``(*x).y''? If all the selectors
are postfix, the problem goes away; there's only one way to interpret
x^.y, x^[z]
(with ``^'' as postfix indirection, a la Pascal). It seems silly to introduce a
notation that *forces* bracketing in half the possibilities (not necessarily
half the cases, of course), when just changing its fixity makes the problem go
away.
The C solution, of course, was to introduce *another* postfix, ``->'', for one
case.
[Some might say that the ambiguities of the examples could be resolved by type
analysis. To this I say (a) prove that there will be no ambiguities left, (b)
one should be able to parse in the absence of type information.]
--
Regards, | Applicants must also have extensive knowledge of Unix, | MIT
Kers. | although they should have sufficiently good programming | job
| taste to not consider this an achievement. | ad.
Technical Details
Message-ID:
<KERS.92Nov20101236@cdollin.hpl.hp.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!hpscit.sc.hp.com!scd.hp.com!hpscdm!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kersReferences:
<id.6S0V.FKH@ferranti.com> <Bxv2t2.4FH@mentor.cc.purdue.edu> <id.GT2V.7OE@ferranti.com> <Bxyut0.Jo@mentor.cc.purdue.edu>Show Full Headers
Complete Article Headers
From: kers@hplb.hpl.hp.com (Chris Dollin) Date: Fri, 20 Nov 1992 10:12:36 GMT Subject: Re: postfix indirection operator in C Message-ID: <KERS.92Nov20101236@cdollin.hpl.hp.com> Organization: Hewlett-Packard Laboratories, Bristol, UK. Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!hpscit.sc.hp.com!scd.hp.com!hpscdm!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers Newsgroups: comp.lang.misc References: <id.6S0V.FKH@ferranti.com> <Bxv2t2.4FH@mentor.cc.purdue.edu> <id.GT2V.7OE@ferranti.com> <Bxyut0.Jo@mentor.cc.purdue.edu> Sender: news@hplb.hpl.hp.com (Usenet News Administrator) Lines: 33 In-Reply-To: hrubin@pop.stat.purdue.edu's message of Thu, 19 Nov 1992 13:58:11 GMT Nntp-Posting-Host: cdollin.hpl.hp.com