mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Trojanowski <bart@jukie.net>
To: Steve Grubb <ddata@gate.net>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: asm/unistd.h
Date: Thu, 5 Apr 2001 11:41:38 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.30.0104051136430.13496-100000@localhost> (raw)
In-Reply-To: <001701c0bde4$59825240$871a24cf@master>

On Thu, 5 Apr 2001, Steve Grubb wrote:

> It would seem to me that after hearing how the macros are used in practice,
> wouldn't turning them into inline functions be an improvement? This is
> something gcc supports, it accomplishes the same thing, and has the added
> advantage of type checking.
> http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC92
>
> Or perhaps type checking macro arguments would be another fertile area for
> the Stanford Checker...

There are benefits to macros too.  One that I like for debuggin is that
the C parser will unravel a macro within the context of the execution:

#ifdef DEBUG
#define KMALLOC(x,y) \
  printk(__FILE__ ":%d: kmalloc(%d,%d")\n", __LINE__,x,y); \
  kmalloc(x,y);
#else
#define KMALLOC(x,y) \
  kmalloc(x,y);
#endif

I think the benefit of a macro here is quite visible... you cannot do this
with an inline.

You may also look at some better reasons:

http://www.uwsg.iu.edu/hypermail/linux/kernel/9810.3/0323.html

[btw I found this by looking for 'macros vs inline' on google/linux]

Bart.

-- 
	WebSig: http://www.jukie.net/~bart/sig/



  reply	other threads:[~2001-04-05 15:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-05 15:23 asm/unistd.h Steve Grubb
2001-04-05 15:41 ` Bart Trojanowski [this message]
2001-04-05 15:45 ` asm/unistd.h David S. Miller
  -- strict thread matches above, loose matches on Subject: below --
2001-04-05 12:58 asm/unistd.h Sardañons, Eliel
2001-04-05 13:06 ` asm/unistd.h Bart Trojanowski
2001-04-05 13:12   ` asm/unistd.h Tim Waugh
2001-04-05 14:26   ` asm/unistd.h Joseph Carter
2001-04-05 14:35     ` asm/unistd.h Bart Trojanowski
2001-04-05 14:35     ` asm/unistd.h Stephen Thomas
2001-04-05 14:45     ` asm/unistd.h Andreas Schwab
2001-04-05 17:38       ` asm/unistd.h J . A . Magallon
2001-04-05 13:07 ` asm/unistd.h David S. Miller
2001-04-05 13:13 ` asm/unistd.h Ben Collins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.30.0104051136430.13496-100000@localhost \
    --to=bart@jukie.net \
    --cc=ddata@gate.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®