Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jan 2005 19:42:23 +0100
From:      Ulrich Spoerlein <q@uni.de>
To:        Paul Richards <paul@originative.co.uk>
Cc:        arch@freebsd.org
Subject:   Re: c99/c++ localised variable definition
Message-ID:  <20050131184223.GG828@galgenberg.net>
In-Reply-To: <20050131170417.GW61409@myrddin.originative.co.uk>
References:  <20050131122609.GA83556@gurney.reilly.home> <90392.1107174969@critter.freebsd.dk> <20050131163117.GE828@galgenberg.net> <20050131165817.GV61409@myrddin.originative.co.uk> <20050131170417.GW61409@myrddin.originative.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 31.01.2005 at 17:04:17 +0000, Paul Richards wrote:
> > > % cc -Wall -std=c99 test.c && ./a.out
> > > 1
> > gcc should be throwing an uninitialised warning here.
> 
> With the right warns it does :-)
> 
> cc -Wall -std=c99 -O -Wuninitialized test.c
> test.c
> test.c: In function `main':
> test.c:7: warning: 'i' might be used uninitialized in this function

Grrr, I knew I should've read the man page. I guess you can't expect to
get _all_ warnings when specifying -Wall
*sigh*

% cc -std=c99 -O -pedantic -Wall -Wshadow -Wuninitialized test.c
test.c: In function `main':
test.c:8: warning: declaration of 'i' shadows a previous local
test.c:7: warning: shadowed declaration is here
test.c:7: warning: 'i' might be used uninitialized in this function

Ulrich Spoerlein
-- 
 PGP Key ID: F0DB9F44				Encrypted mail welcome!
Fingerprint: F1CE D062 0CA9 ADE3 349B  2FE8 980A C6B5 F0DB 9F44
Ok, which part of "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn."
didn't you understand?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050131184223.GG828>