From: Soubhik <soubhik@noida.atrenta.com>
To: GCC-Help List <gcc-help@gcc.gnu.org>
Cc: ayan@noida.atrenta.com, debasish@noida.atrenta.com,
soubhik@noida.atrenta.com
Subject: Wshadow Problem
Date: Mon, 18 Feb 2002 15:23:00 -0000 [thread overview]
Message-ID: <3C713656.45375975@noida.atrenta.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 947 bytes --]
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.
[-- Attachment #2: Card for Soubhik --]
[-- Type: text/x-vcard, Size: 219 bytes --]
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
reply other threads:[~2002-02-18 17:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3C713656.45375975@noida.atrenta.com \
--to=soubhik@noida.atrenta.com \
--cc=ayan@noida.atrenta.com \
--cc=debasish@noida.atrenta.com \
--cc=gcc-help@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).