Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@debian.org>
To: Justin Carlson <justinca@cs.cmu.edu>
Cc: linux-mips@oss.sgi.com
Subject: Re: Function pointers and #defines
Date: Thu, 30 May 2002 15:50:52 -0400	[thread overview]
Message-ID: <20020530195052.GA10587@branoic.them.org> (raw)
In-Reply-To: <1022787167.14210.472.camel@ldt-sj3-022.sj.broadcom.com>

On Thu, May 30, 2002 at 12:32:47PM -0700, Justin Carlson wrote:
> A fair number of places in the headers, we have stuff like this:
> 
> void (*_some_fn)(int arg1, int arg2);
> #define some_fn(arg1, arg2) _some_fn(arg1, arg2)
> 
> Why do we do this, as opposed to:
> 
> void (*some_fn)(int arg1, int arg2);
> 
> Both syntaxes result in being able to say
> 
> some_fn(1, 2);
> 
> but the latter is both clearer and shorter.  Is there some deep,
> mystical C reason that we use the former, or did someone do it that way
> a long time ago and no one has changed it?

At a guess, this prevents taking the address of the function
unintentionally...

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

  reply	other threads:[~2002-05-30 19:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-30 19:32 Function pointers and #defines Justin Carlson
2002-05-30 19:50 ` Daniel Jacobowitz [this message]
2002-05-30 19:58   ` Justin Carlson
2002-05-30 21:18   ` Kevin D. Kissell
2002-05-30 21:18     ` Kevin D. Kissell
2002-05-31  9:15     ` Gleb O. Raiko

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=20020530195052.GA10587@branoic.them.org \
    --to=dan@debian.org \
    --cc=justinca@cs.cmu.edu \
    --cc=linux-mips@oss.sgi.com \
    /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