From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18833 invoked by alias); 18 Feb 2002 17:14:56 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 18706 invoked from network); 18 Feb 2002 17:14:45 -0000 Received: from unknown (HELO gangotri.noida.atrenta.com) (203.190.133.139) by sources.redhat.com with SMTP; 18 Feb 2002 17:14:45 -0000 Received: from noida.atrenta.com (rambo [192.168.3.69]) by gangotri.noida.atrenta.com (8.9.3+Sun/8.9.1) with ESMTP id WAA28515; Mon, 18 Feb 2002 22:44:35 +0530 (IST) Message-ID: <3C713656.45375975@noida.atrenta.com> Date: Mon, 18 Feb 2002 15:23:00 -0000 From: Soubhik Organization: Atrenta, India X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: GCC-Help List CC: ayan@noida.atrenta.com, debasish@noida.atrenta.com, soubhik@noida.atrenta.com Subject: Wshadow Problem Content-Type: multipart/mixed; boundary="------------BEA25B9BF274851AD1F49385" X-SW-Source: 2002-02/txt/msg00174.txt.bz2 This is a multi-part message in MIME format. --------------BEA25B9BF274851AD1F49385 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 947 Hi! i've encountered something very funny. i've a very simple program which, if treated as a c file (extension .c) and compiled with -Wshadow option, generates a warning. the same program, if treated as a c++ file (extension .cpp) and compiled with same command options, does not give any warning. Here's the simple program: typedef int myint; extern void foo(myint myint); Here's c compilation: #gcc -c -Wshadow typetest.c typetest.c:3: warning: declaration of `myint' shadows global declaration # And this is c++ compilation: #gcc -c -Wshadow typetest.cpp # gcc version info: #gcc -v Reading specs from /usr/local/gcc/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs gcc version 2.95.2 19991024 (release) # Finally, this is what the man page of gcc says: -Wshadow Warn whenever a local variable shadows another local variable. any attempt to get me out of this confusion will be really appreciated. cheers! soubhik. --------------BEA25B9BF274851AD1F49385 Content-Type: text/x-vcard; charset=us-ascii; name="soubhik.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Soubhik Content-Disposition: attachment; filename="soubhik.vcf" Content-length: 219 begin:vcard n:Bhattacharya;Soubhik x-mozilla-html:TRUE org:Atrenta, India. adr:;;;;;; version:2.1 email;internet:soubhik@noida.atrenta.com title:Software Engineer x-mozilla-cpt:;16192 fn:Soubhik Bhattacharya end:vcard --------------BEA25B9BF274851AD1F49385--