Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!mcnc!rti!xyzzy!throopw From: throopw@xyzzy.UUCP (Wayne A. Throop) Newsgroups: comp.lang.c Subject: Re: Silly program [was Re: Style [++i vs i++] ] Message-ID: <206@xyzzy.UUCP> Date: Mon, 17-Aug-87 13:17:13 EDT Article-I.D.: xyzzy.206 Posted: Mon Aug 17 13:17:13 1987 Date-Received: Tue, 18-Aug-87 05:23:51 EDT References: <8298@brl-adm.ARPA> <587@cblpe.ATT.COM> <189@xyzzy.UUCP> <513@ivax.doc.ic.ac.uk> <234@nvpna1.UUCP> Organization: Data General, RTP NC. Lines: 46 > dcw@doc.ic.ac.uk (Duncan C White) >> throopw@xyzzy.UUCP (Wayne A. Throop) >>What scares me is that a++ *does* always add 1. > Agreed [...] But I don't quite see why that scares Wayne : > It seems like the most convenient behaviour to me.. And to me. I see I misspoke there. I meant to say that I was scared that anybody would think otherwise. Switching to a different article: > strouckn@nvpna1.UUCP (Louis Stroucken 42720) >> msb@sq.UUCP (Mark Brader) >>Actually, *declaring* such a pointer is probably illegal. > I haven't got any ANSI draft here, so I'd better stay out of the > discussion, but: > Please note that "a" is a formal argument of main!! Ok. Noted. The type of "a" is (char (*)[]). That is, "a" is a pointer. > K&R appendix A section 10.4 says on array arguments: > ...formal parameters declared "array of..." are adjusted to read > "pointer to...". Since "a" is a pointer, this passage does not apply. Repeat: THIS PASSAGE DOES NOT APPLY. > The declaration of "a" might as well read "char **a;". "a++;" should > increment "a" with sizeof( char * ) bytes. Wrong. Wrong. Wrong. A formal declared as type (char *[]) "might as well" be declared with type (char **). But that's not what was going on. The formal was of type (char (*)[]), which is not now, never has been, and Bog willing never will be, equivalent to the type (char **). > If I miss something, please let me know. Consider yourself let. I also post, because this is a common and recurring misconception that I'd like to nip in the bud (this instance of it, anyway). -- In analyzing history do not be too profound, for often the causes are quite superficial. --- Emerson