From owner-freebsd-current Fri Nov 15 2:45:27 2002 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 2665F37B401; Fri, 15 Nov 2002 02:45:26 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id E7BA443E6E; Fri, 15 Nov 2002 02:45:24 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id VAA13700; Fri, 15 Nov 2002 21:45:20 +1100 Date: Fri, 15 Nov 2002 21:57:58 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Mike Barcroft Cc: Archie Cobbs , Marc Recht , Garrett Wollman , Subject: Re: addition to cdefs In-Reply-To: <20021113103111.B98651@espresso.q9media.com> Message-ID: <20021115214346.U13981-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 On Wed, 13 Nov 2002, Mike Barcroft wrote: > Bruce Evans writes: > > Both have large namespace pollution (p and n are in the application > > namespace). Both give huge code wih a copy of the function in every > > object file whose source file(s) include this header if inline functions > > are not actually inline (which happens if the compiler is gcc -O0 or > > non-gcc). > > I fixed the namespace problems in the version I posted for review on > -standards. Do you see any problems with changing FD_ZERO() to: > > #define FD_ZERO(p) do { \ > fd_set *_p = (p); \ > __size_t _n = _howmany(FD_SETSIZE, _NFDBITS); \ > while (_n > 0) \ > _p->__fds_bits[--_n] = 0; \ > } while (0); > > ...to overcome the issues with the inline version? I think avoiding the inline function is especially worthwile here, since FD_ZERO is is always defined in in the default (__BSD_VISIBLE) case and that won't change soon. The above version has a bug: the semicolon at the end defeats the point of the `do ... while (0)'. I would format it a little differently (tab instead of space after #define; space instead of tab before `do', and maybe not initialize variables in declarations, and maybe leave a blank line after the declarations -- I like to use normal formatting for macros unless breaking the normal formatting can be used to get 1-line macros. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message