Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: Orphaned Response Message-ID: <86900041@haddock> Date: Fri, 5-Sep-86 11:09:00 EDT Article-I.D.: haddock.86900041 Posted: Fri Sep 5 11:09:00 1986 Date-Received: Fri, 5-Sep-86 23:59:09 EDT References: <292@tflop.UUCP> Lines: 22 Nf-ID: #R:tflop.UUCP:292:haddock:86900041:000:1167 Nf-From: haddock!karl Sep 5 11:09:00 1986 killer!tad (Tad Marko) writes: >In my original article, ... I was asking if I should use >"foo(parm) char **parm; {...}" or "foo(parm) char *parm[]; {...}" >and I *DID* test both of them, and they both worked. Okay, that's a more sensible question. The official truth is that in this context, they are equivalent. However, my *personal opinion* is that the former is "more correct"; the latter is a kludge where the compiler figures out what you "must have really meant" and converts it for you. (Kind of like how some compilers will interpret "&a" as "&a[0]" if "a" is an array, though in that case you'll probably get a warning at least.) My recommendation is to write "char **parm"; it causes less confusion. Even if you do write "char *parm[]", you are declaring a pointer, not an array. (Similarly, a formal argument declared "float parm" really declares a double, which is also quite confusing, e.g. if you take its address.) Oh yes, some compilers used to consider a parameter declared "type x[]" to be a *non-modifiable* pointer to type. That no longer seems to be popular. Karl W. Z. Heuer (ima!haddock!karl; karl@haddock.isc.com), The Walking Lint