Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: qualifications in prototypes Message-ID: <13501@smoke.BRL.MIL> Date: 7 Aug 90 12:20:31 GMT References: <386@taumet.com> <17240@haddock.ima.isc.com> <1896@tkou02.enet.dec.com> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 18 In article <1896@tkou02.enet.dec.com> diamond@tkou02.enet.dec.com (diamond@tkovoa) writes: >In article <476@mtndew.UUCP> friedl@mtndew.UUCP (Stephen J. Friedl) writes: >SF> extern int stat(char *filename, struct stat *stptr); >SF>Shouldn't the "filename" argument be const qualified? More accurately, *filename should be const-qualified. The relevant constraints are given in 3.3.16.1, in particular: both operands are pointers to qualified or unqualified versions of compatible types, and the type pointed to by the left [in this context, the declared function parameter] has all the qualifiers of the type pointed to by the right [the actual function argument]. Certainly, const char * has all the qualifiers of char *, as well as one additional qualifier. For practical examples, see many of the standard library functions in section 4 of the standard.