public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* ANSI C, type composition, constant arrays in function arguments
@ 2008-09-21 18:58 Mikoláš Janota
2008-09-21 23:04 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: Mikoláš Janota @ 2008-09-21 18:58 UTC (permalink / raw)
To: gcc-bugs
According to the ANSI C standard, functions' respective arguments have
to be compatible for the function types to be compatible (6.7.5.3).
However, the following declarations
void p(int p[30]);
void p(int p[4]);
do not yield a warning.
--
Mikoláš Janota M. Sc.
School of Computer Science and Informatics,
University College Dublin,
Belfield,
Dublin 4,
Ireland
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ANSI C, type composition, constant arrays in function arguments
2008-09-21 18:58 ANSI C, type composition, constant arrays in function arguments Mikoláš Janota
@ 2008-09-21 23:04 ` Andreas Schwab
2008-09-22 0:25 ` Mikoláš Janota
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2008-09-21 23:04 UTC (permalink / raw)
To: Mikoláš Janota; +Cc: gcc-bugs
"Mikoláš Janota" <mikolas.janota@gmail.com> writes:
> However, the following declarations
> void p(int p[30]);
> void p(int p[4]);
>
> do not yield a warning.
See 6.7.5.3#7.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ANSI C, type composition, constant arrays in function arguments
2008-09-21 23:04 ` Andreas Schwab
@ 2008-09-22 0:25 ` Mikoláš Janota
0 siblings, 0 replies; 3+ messages in thread
From: Mikoláš Janota @ 2008-09-22 0:25 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gcc-bugs
Thanks Andreas pointing me to part of the standard that I have missed.
However, is it crystal clear in the following parts of the document we
are talking about parameters and a return type *after adjustment*?
To be honest, I would still vote for at least a warning. After all,
what is the point of writing a constant size for an array parameter if
the typechecker throws it away?
mikolas
2008/9/22 Andreas Schwab <schwab@suse.de>:
> "Mikoláš Janota" <mikolas.janota@gmail.com> writes:
>
>> However, the following declarations
>> void p(int p[30]);
>> void p(int p[4]);
>>
>> do not yield a warning.
>
> See 6.7.5.3#7.
>
> Andreas.
>
> --
> Andreas Schwab, SuSE Labs, schwab@suse.de
> SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>
--
Mikoláš Janota M. Sc.
School of Computer Science and Informatics,
University College Dublin,
Belfield,
Dublin 4,
Ireland
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-22 0:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-21 18:58 ANSI C, type composition, constant arrays in function arguments Mikoláš Janota
2008-09-21 23:04 ` Andreas Schwab
2008-09-22 0:25 ` Mikoláš Janota
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).