🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3753

Re: Compatibility and rewrite rules

#3753
From: Dan Pop
Date: Wed, 16 Aug 1995 21:08
34 lines
1313 bytes
In <40sudg$7jn@newshost.lanl.gov> tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) writes:

>Is the following translation unit strictly conforming. If not, does it
>_require_ a diagnostic?
>
>void f(int  [5]);
>void f(int x[3]) { }

No diagnostic is _required_.

    ANSI 3.5.4.3:

    (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 $3.7.1. ...)

    ANSI 3.7.1:

    A declaration of a parameter as ``array of type '' shall be adjusted to
    ``pointer to type ,'' ...

So, your example "decays" to:

void f(int *);
void f(int *x) { }

And the declaration is perfectly compatible with the definition.

Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@mail.cern.ch 
Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
Technical Details
Message-ID: <danpop.808607335@rscernix>
Path: arc1-ca.pugleaf.net!CERN.ch!rscernix!danpop
References: <40sudg$7jn@newshost.lanl.gov>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!CERN.ch!rscernix!danpop
From: Dan.Pop@mail.cern.ch (Dan Pop)
Subject: Re: Compatibility and rewrite rules
X-Nntp-Posting-Host: ues5.cern.ch
Message-ID: <danpop.808607335@rscernix>
Sender: news@news.cern.ch (USENET News System)
Organization: CERN European Lab for Particle Physics
X-Newsreader: NN version 6.5.0 #9 (NOV)
References: <40sudg$7jn@newshost.lanl.gov>
Date: Wed, 16 Aug 1995 21:08:55 GMT