Article View: comp.std.c
Article #3746Re: Compatibility and rewrite rules
From: Denizen of the Deep
Date: Wed, 16 Aug 1995 15:55
Date: Wed, 16 Aug 1995 15:55
31 lines
1478 bytes
1478 bytes
In article <40sudg$7jn@newshost.lanl.gov>,
Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov> wrote:
>Is the following translation unit strictly conforming. If not, does it
>_require_ a diagnostic?
>
>void f(int [5]);
>void f(int x[3]) { }
>
>Cheers
>Tanmoy
Yes, I believe this is strictly conforming. From ISO 6.5.4.3, last
paragraph before the example:
...the parameter type lists, if both are present, shall agree
in the number of parameters...corresponding parameters shall
have compatible types....For each parameter declared with
function or array type, its type for these comparisons is the
one that results from conversion to a pointer type, as in 6.7.1.
And from ISO 6.7.1:
A declaration of a parameter as "array of type" shall be adjusted
to "pointer to type...."
My reading of this is that an array of some particular type will
be seen in a parameter type list as a pointer to that type, regardless
of the length of the array. In function f above, the lengths are
therefore ignored, yielding compatible pointer types.
-Jon
Technical Details
Message-ID:
<40t4e9$qqi@Radon.Stanford.EDU>Path:
arc1-ca.pugleaf.net!Xenon.Stanford.EDU!beckerReferences:
<40sudg$7jn@newshost.lanl.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!Xenon.Stanford.EDU!becker From: becker@Xenon.Stanford.EDU (Denizen of the Deep) Newsgroups: comp.std.c Subject: Re: Compatibility and rewrite rules Date: 16 Aug 1995 15:55:53 GMT Organization: Computer Science Department, Stanford University. Message-ID: <40t4e9$qqi@Radon.Stanford.EDU> References: <40sudg$7jn@newshost.lanl.gov> NNTP-Posting-Host: xenon.stanford.edu