Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!decwrl!decvax!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: address of function Message-ID: <13731@haddock.ima.isc.com> Date: 16 Jun 89 02:46:48 GMT References: <2700@solo8.cs.vu.nl> <370@msor0.UUCP> <1817@auspex.auspex.com> <10361@socslgw.csl.sony.JUNET> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 27 In article <10361@socslgw.csl.sony.JUNET> diamond@csl.sony.junet (Norman Diamond) writes: >In article <1817@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: >>["int this[100], *that = &this;" is not legal ANSI C] > >Oh I'm so glad ANSI is standardizing existing practices instead of >inventing new RESTRICTIONS. This rule won't break much existing, >FORMERLY UNBROKEN source code, now will it? :-S (sarcasm) No, it won't break any correct code, and it removes a restriction rather than adding one. Pre-ANSI C did not allow one to apply "&" to an array (see K&R1, p. 94, next to last paragraph). Perhaps you're thinking of the "feature" that certain compilers flag this as a warning only, and ignore the "&". >Could one also do it in this way? > int this[100], *that = (int *)&this; > int this[100], *that = (void *)&this; I suppose that would work, but why don't you just write "that = &this[0]" (or even "that = this"), if that's your intent? >i.e.: when a cast implies an assignment to an anonymous temporary, it >becomes a non-lvalue -- ok; but does it also become a non-constant? I can't think of any context in which the language cares whether an rvalue is a "constant" or not. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint