Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ames!amdcad!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.lang.c Subject: Re: char (*a)[] (was: Style [++i vs i++]) Message-ID: <26296@sun.uucp> Date: Sat, 22-Aug-87 02:38:08 EDT Article-I.D.: sun.26296 Posted: Sat Aug 22 02:38:08 1987 Date-Received: Sun, 23-Aug-87 11:38:04 EDT References: <8942@brl-adm.ARPA> Sender: news@sun.uucp Lines: 23 > So this means I should be able to say: > > a = &b; > > However, as I understand it, b is actually &b[0], which means a gets set > to &&b[0], which I'm not sure makes any sense at all. Well, given the current way array names (or array-valued expressions) are treated, it doesn't. PCC will treat "&b" as being equivalent to "b". However, in the langugage described by the current ANSI C draft standard, the "b is actually &b[0]" rule does not apply in certain contexts; one such context is that of an operand of "&". So, in ANSI C, "&b" is valid, and does make sense; it is a pointer to the array "b", as opposed to being a pointer to the first member of that array. (It is a trivial change to PCC to implement this; you just delete a couple of lines in "cgram.y", namely the one that converts the type of "&b" to "pointer to " and the one that prints a warning message telling you it is doing so.) Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com