From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6724 invoked by alias); 27 Nov 2011 14:55:40 -0000 Received: (qmail 6714 invoked by uid 22791); 27 Nov 2011 14:55:38 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Nov 2011 14:55:25 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RUg8W-0006Wo-Tm from pedro_alves@mentor.com ; Sun, 27 Nov 2011 06:55:21 -0800 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 27 Nov 2011 14:55:16 +0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [PATCH 18/348] Fix -Wsahdow warnings Date: Sun, 27 Nov 2011 14:55:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-12-generic; KDE/4.7.2; x86_64; ; ) Cc: Mark Kettenis , eliz@gnu.org, brobecker@adacore.com, andrew.smirnov@gmail.com References: <201111231640.pANGefc4031803@d06av02.portsmouth.uk.ibm.com> <83aa7k83p0.fsf@gnu.org> <201111271352.pARDqjCg025404@glazunov.sibelius.xs4all.nl> In-Reply-To: <201111271352.pARDqjCg025404@glazunov.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201111271455.14364.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00734.txt.bz2 On Sunday 27 November 2011 13:52:45, Mark Kettenis wrote: > What I'm saying is that a local variable shadowing a function is never > a problem. It would only be a problem if inside the function that has > the local variable, you'd (accidentally) try to invoke the function. > That's why I came up with the example: > > void foo(void); > > void > bar(void) > { > int foo; > > foo(); > } > > where the function foo() is being called when it is being shadowed by > a local variable. This won't compile on *any* C compiler, simply > because it isn't legal C. > Unless the variable is a function pointer. -- Pedro Alves