Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2001 10:59:25 -0800
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        j mckitrick <jcm@FreeBSD-uk.eu.org>
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>
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 %2B0000
References:  <20010316182415.A33526@dogma.freebsd-uk.eu.org>

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

--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




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