Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!csd4.milw.wisc.edu!uakari.primate.wisc.edu!indri!ames!ncar!ico!ism780c!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: What is the scope of "type-name" in a cast expression? Message-ID: <14229@haddock.ima.isc.com> Date: 8 Aug 89 16:09:09 GMT References: <1324@majestix.ida.liu.se> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 22 In article <1324@majestix.ida.liu.se> mikpe@majestix.ida.liu.se (Mikael Pettersson) writes: >What is the scope of the "type-name" in a cast expression? >My impression is that the scope should be the entire surrounding >expression (but not any further), There is no such thing as "expression-scope" in C. Except for labels (which have function scope) and things declared within the parmlist of a non-defining function prototype declaration (which have prototype scope, a very short scope), each identifier has either block scope or file scope. In your examples, the identifiers have block scope. (Some clarifications: externally-declared static objects have file scope but internal linkage. Externally-declared non-static objects have file scope and external linkage, which used to be called "program scope". Function parameters have block scope, the block in question being the outermost block of the function; this differs from function scope, since parameter identifiers can be redeclared in an inner block, but label identifiers cannot.) Reference: 3.1.2.1 pANS. The same rules (except for prototypes) apply to pre-ANSI C, but the pANS has the most precise description I've seen. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint