svn rev #19169: trunk/src/ include/ lib/crypto/crc32/ lib/gssapi/krb5/ lib/gssapi/mechglue/ ...
Jeffrey Hutzelman
jhutz at cmu.edu
Mon Feb 19 17:09:12 EST 2007
On Monday, February 19, 2007 03:59:13 PM -0500 Ken Raeburn
<raeburn at mit.edu> wrote:
> On Feb 19, 2007, at 11:42, Chaskiel M Grundman wrote:
>> It isn't an error to use a non-const object in a const parameter,
>> and the
>> compiler would be wrong to treat it as such. What is an error is
>> for the
>> definition of a function to be different from any of it's
>> declarations (or
>> prototypes). That seems to be what this patch is changing.
>
> No, I believe that's okay as well. I can't find my copy of C89 at
> the moment, and C89 is *mostly* what we require, but the C99 spec
> says of multiple declarations of a function that corresponding
> parameters are required to have compatible types, BUT:
>
> "In the determination of type
> compatibility and of a composite type, each parameter declared with
> function or array
> type is taken as having the adjusted type and each parameter declared
> with qualified type
> is taken as having the unqualified version of its declared type."
>
> I think C89 said something similar, but I may be mistaken.
C89 says...
6.5 ... All declarations in the same scope that refer to the same
object or function shall specify compatible types.
6.5.4.3 ... For two function types to be compatible, both shall specify
compatible return types. Moreover, the parameter type lists, if
both are present, shall agree in the number of parameters and in
use of the ellipsis terminator; corresponding parameters shall
have compatible types.... For each parameter declared with
qualified type, its type for these comparisons is the unqualified
version of its declared type.
Note that parameter types are compared without regard to the const
qualifier, but the return type is not. However, the patch in question does
not appear to change the return types of any functions; it almost
exclusively removes the const qualifier from declared parameter types.
-- Jeff
More information about the krbdev
mailing list