Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Information hiding Message-ID: <3646@haddock.ISC.COM> Date: 27 Apr 88 04:34:16 GMT References: <10576@steinmetz.ge.com> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 24 In article <10576@steinmetz.ge.com> davidsen@steinmetz.ge.com (William E. Davidsen Jr) writes: >One of the things which bothers me about the C language is that many (most) >compilers, and lint, complain about taking the address on an array. Fixed in dpANS. >Not that it isn't redundant, Actually it's not redundant -- on compilers that do it right, "a" and "&a[0]" are equivalent and have type "sometype *", but "&a" has type "sometype (*)[]". (If cast to a common compatible type, they will be equal, however.) >but there is a good reason for allowing it...: information hiding. Agreed. It's because of this botch that "jmp_buf" is required to be an array type: it's passed by value to setjmp. Ideally, the argument of setjmp should be of type "jmp_buf *". >NOTE: This applies to addresses of procedures, too, in some cases. It's not clear whether ANSI C implementations will issue warnings for "pf=&f". I hope not; I think that syntax makes more sense than "pf=f", and would use it exclusively if not for the stupid warning on PCC-based compilers. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint