From owner-freebsd-chat Fri Mar 16 11:12:39 2001 Delivered-To: freebsd-chat@freebsd.org Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by hub.freebsd.org (Postfix) with ESMTP id A8F3837B718 for ; Fri, 16 Mar 2001 11:12:36 -0800 (PST) (envelope-from brdavis@odin.ac.hmc.edu) Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.11.0/8.11.0) id f2GIxP127719; Fri, 16 Mar 2001 10:59:25 -0800 Date: Fri, 16 Mar 2001 10:59:25 -0800 From: Brooks Davis To: j mckitrick Cc: freebsd-chat@FreeBSD.ORG Subject: Re: Is there a rule of them when to use macros? Message-ID: <20010316105925.C12128@Odin.AC.HMC.Edu> References: <20010316182415.A33526@dogma.freebsd-uk.eu.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="O3RTKUHj+75w1tg5" Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20010316182415.A33526@dogma.freebsd-uk.eu.org>; from jcm@FreeBSD-uk.eu.org on Fri, Mar 16, 2001 at 06:24:15PM +0000 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --O3RTKUHj+75w1tg5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 16, 2001 at 06:24:15PM +0000, j mckitrick wrote: >=20 > I'm sure there is one, but when do you make a macro a short function and > vice versa? Pretty much never. There are times when using a macro is a reasonable thing to do, but IMO, most of them are for readability rather then speed. In one of the programs I spend a lot of time hacking on there were places were I had considered using macros in place of some accessor functions, but after profiling I desided that I really didn't need that >1sec out of a 45min runtime at the cost of type checking. Places I like macros are in hiding repetative arguments to complex function calls like the macros that declare ioctls (see /usr/include/sys/ioccom.h). -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --O3RTKUHj+75w1tg5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE6smKLXY6L6fI4GtQRAoylAKCUWB+Pxqp4uKxSoBjW89qZ30M/dgCfZy+i 2gbycQ1f/WSiEk6Sl1ST1bo= =+QO1 -----END PGP SIGNATURE----- --O3RTKUHj+75w1tg5-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message