Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2001 20:06:28 +0000
From:      j mckitrick <jcm@FreeBSD-uk.eu.org>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        freebsd-chat@FreeBSD.ORG
Subject:   I mean, rule of THUMB when to use macros
Message-ID:  <20010316200628.A34692@dogma.freebsd-uk.eu.org>
In-Reply-To: <20010316105925.C12128@Odin.AC.HMC.Edu>; from brooks@one-eyed-alien.net on Fri, Mar 16, 2001 at 10:59:25AM -0800
References:  <20010316182415.A33526@dogma.freebsd-uk.eu.org> <20010316105925.C12128@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
I can't believe I mispelled 'thumb'  :-\

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

Hmmm, that's what I'm seeing.

| are in hiding repetative arguments to complex function calls like the
| macros that declare ioctls (see /usr/include/sys/ioccom.h).

That's what I'm using them for.  Some repeated groups of statements that are
preambles and cleanups for some function calls.  Nothing overly complex, but
it makes it easier to read.


jm
-- 
---------------------------------------------------------------
Jonathon McKitrick -- jcm@freebsd-uk.eu.org           
"It took the computing power of three C-64s to fly to the Moon.
It takes a 486 to run Windows 95. Something is wrong here."
---------------------------------------------------------------

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?20010316200628.A34692>