Path: utzoo!attcan!uunet!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: qualifications in prototypes (was Re: Problems with IBM RS6000 C compiler) Message-ID: <17247@haddock.ima.isc.com> Date: 7 Aug 90 14:17:17 GMT References: <476@mtndew.UUCP> <1893@tkou02.enet.dec.com> <386@taumet.com> <17240@haddock.ima.isc.com> <1896@tkou02.enet.dec.com> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 32 In article <1896@tkou02.enet.dec.com> diamond@tkou02.enet.dec.com (diamond@tkovoa) writes: >[Can you pass an unqualified `char *' to a function whose prototype declares >a parameter of type `char const *'?] > >Section 3.3.2.2: "Each argument shall have a type such that its value >may be assigned to an object with the unqualified version of the type of >its corresponding parameter." I agree the the question is equivalent to that of simple assignment. >I interpret that the "unqualified version" of a type only removes the >top-level qualifiers. [3.1.2.5 supports this.] I'm willing to grant that, too. >The Rationale for section 3.1.4 further emphasizes the matter of what >cannot be assigned to what, which seems to support my opinion on the >function arguments. It mentions only the assignment *from* qualified *to* unqualified. Nobody disputes that this is illegal without a cast. >Section 3.2.2.3 specifies what pointers may be converted and still compare >equal. It does not specify that conversions are applied automatically >without a cast. Sorry, but I believe it is irrelevant to the topic. Okay, then, let's try 3.3.16.1 Simple Assignment: "Constraints: One of the following shall hold: ... both operands are pointers to qualified or unqualified versions of compatible types, and the type pointed to by the left has all the qualifiers of the type pointed to by the right." Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint