From owner-freebsd-current Sat Feb 1 16:31:58 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D77C37B401 for ; Sat, 1 Feb 2003 16:31:57 -0800 (PST) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id E9C5743F75 for ; Sat, 1 Feb 2003 16:31:55 -0800 (PST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.6/8.12.6) with ESMTP id h120Vmbs031195 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Sat, 1 Feb 2003 19:31:48 -0500 (EST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.6/8.12.6/Submit) id h120VlBO031192; Sat, 1 Feb 2003 19:31:47 -0500 (EST) (envelope-from wollman) Date: Sat, 1 Feb 2003 19:31:47 -0500 (EST) From: Garrett Wollman Message-Id: <200302020031.h120VlBO031192@khavrinen.lcs.mit.edu> To: Bakul Shah Cc: current@FreeBSD.ORG Subject: Re: Style fixups for proc.h In-Reply-To: <200302020002.TAA24089@warspite.cnchost.com> References: <200302012315.h11NFVaX028348@grimreaper.grondar.org> <200302020002.TAA24089@warspite.cnchost.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG < said: > I can't see what actual error is avoided by this warning. It's a potential error -- if there were an actual error, it would be an error and not a warning. The issue is simple: Say you have an object and a function declared in global scope: int foo; /* many lines of declarations */ /* perhaps this is even in a different file */ void bar(quux_t foo); At some point, somebody changes the spelling of `foo' and adds a preprocessor macro for compatibility: union baz { int foo; struct frotz *gorp; } foobaz; #define foo foobaz.foo What happens to the declaration of that function? Well, void bar(quux_t foobaz.foo); is a syntax error. My personal opinion, which is different from what style(9) recommends, is that parameter names should be omitted for all functions, EXCEPT those with ambiguous parameter types. Most functions in the kernel only operate on one object of a given type at a time, so even without the names it is (or should be) obvious what the object is used for. Some functions, however, take multiple objects of the same type (e.g., two different sorts of flags); in these cases some additional help may be warranted. In the case of user headers, if parameter names are included, they MUST be protected, because they would otherwise be polluting the user's namespace. Hence, most headers historically do not use parameter names. -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message