public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6940: taking sizeof array parameter should trigger a warning
@ 2002-09-14 15:11 nathan
0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-09-14 15:11 UTC (permalink / raw)
To: Marco.Franzen, gcc-bugs, gcc-prs, nobody
Synopsis: taking sizeof array parameter should trigger a warning
State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Sat Sep 14 15:11:19 2002
State-Changed-Why:
this seems like a sensible warning
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6940
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/6940: taking sizeof array parameter should trigger a warning
@ 2002-06-05 14:16 Marco.Franzen
0 siblings, 0 replies; 2+ messages in thread
From: Marco.Franzen @ 2002-06-05 14:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 6940
>Category: c++
>Synopsis: taking sizeof array parameter should trigger a warning
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Jun 05 14:16:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Marco Franzen
>Release: gcc-3.1
>Organization:
>Environment:
>Description:
Neither the C nor the C++ front-end of GCC 3.1 issues a warning for this. (I tried -W -Wall for both.)
I know the generated code is absolutely correct, but a warning would be in order (and should probably be on by default, given it will be rare outside obfuscation contests).
>How-To-Repeat:
int func(int array[], int* pointer)
{
int n1 = sizeof(array); // no, it isn't
int n2 = sizeof(pointer);
return n1 - n2;
}
int main()
{
int v[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
return func (v, v);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-09-14 22:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-14 15:11 c++/6940: taking sizeof array parameter should trigger a warning nathan
-- strict thread matches above, loose matches on Subject: below --
2002-06-05 14:16 Marco.Franzen
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).