Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Feb 2003 16:21:24 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Juli Mallett <jmallett@FreeBSD.ORG>
Cc:        Bakul Shah <bakul@bitblocks.com>, Mark Murray <mark@grondar.org>, Julian Elischer <julian@elischer.org>, current@FreeBSD.ORG
Subject:   Re: Style fixups for proc.h
Message-ID:  <200302020021.h120LOId018100@apollo.backplane.com>
References:  <200302012315.h11NFVaX028348@grimreaper.grondar.org> <200302020002.TAA24089@warspite.cnchost.com> <20030201161408.B64200@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

:If a named prototype clashes with something in global scope,
:isn't it still a shadowing issue?  They should probably never
:be *in* scope.
:-- 
:Juli Mallett <jmallett@FreeBSD.org>
:AIM: BSDFlata -- IRC: juli on EFnet

    I finally was able to reproduce the bug.  But it's an obvious bug in the
    compiler at least in regards to named arguments in prototypes.
    The -Wshadow switch causes the error message to be produced and it
    occurs both for named arguments in prototypes and, named arguments
    in the procedure proper, and named locals in the procedure.

    The solution is simply to name the arguments in the prototype the same
    as the arguments in the procedure.  If we are going to use -Wshadow then
    the arguments in the procedure will generate the error too so naming
    the prototype arguments the same will not make things any better OR worse.

    So the prototype arguments should either be named the same as those in the
    procedure proper, or should not be named at all.  

    We definitely should not go adding underscores to the prototypes to
    work around this problem.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>

int x;

int fubar(int x);


int
fubar(int y)
{
    int x = 2;

    ++x;
    y = 1;
    return(1);
}

int
fubar2(int x)
{
    ++x;
    return(1);
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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