From: Sylvester Diehl <diehl@dachau.marco.de>
To: gcc@gcc.gnu.org
Cc: diehl@dachau.marco.de (Sylvester Diehl)
Subject: attribute initialized
Date: Mon, 11 Jul 2005 18:07:00 -0000 [thread overview]
Message-ID: <m1Ds2ga-007uQcC@hera.dachau.marco.de> (raw)
Hello
why doesn't gcc (-Wall -Wuninitalized -O) detect
an uninialized variable passed by reference
decleared as <type> const *<name> ?
Do we need an attribute like (("initialized")) in the
function prototype to give gcc an hint to force
checking of uninitalized parameters ?
example
file foo.c:
--------- cut here
/*
gcc -Wall -Wuninitialized -O foo.c
*/
#include <stdio.h>
int foo(int const *p)
{
static int sum = 0;
sum += *p;
return sum;
}
int main(int argc, char **argv)
{
int k;
return printf("%d\n", foo(&k));
}
--------- cut here end of file foo.c
p.s. i know i could pass the variable by value
to get a warning of an uninitalized variable.
--
Sylvester Diehl
marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161 42
Hans-Böckler-Str. 2, D 85221 Dachau Fax +49 8131 5161 66
http://www.marco.de/ Email diehl@marco.de
next reply other threads:[~2005-07-11 18:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-11 18:07 Sylvester Diehl [this message]
2005-07-11 19:06 ` Joe Buck
2005-07-12 9:34 ` Dave Korn
2005-07-12 9:56 ` Falk Hueffner
2005-07-12 9:56 ` Dave Korn
2005-07-13 14:09 ` Sylvester Diehl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1Ds2ga-007uQcC@hera.dachau.marco.de \
--to=diehl@dachau.marco.de \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).