On Fri, Dec 14, 2001 at 03:04:25AM +0900, Issac Trotts wrote:
> What does _( ... ) mean?

It is for old compilers that don't support prototypes.  In old skool
(pre-ANSI) C, I might write:

  void foo();

  void bar()
  {
    foo(42);
  }

  void foo(x)
    int x;
  {
    printf("%d\n", x)
  }

in ANSI C, I can write the same thing, but it is not safe, since the
compiler does not know how many or what type of arguments foo() expects;
the job of making sure the arguments are correctly specified is left up
to the programmer.

So as a compromise (both to allow compatibility with old compilers and
to provide type-safety on newer post-1989 compilers), Ruby uses a macro:

  #ifdef HAVE_PROTOTYPES
  # define _(args) args
  #else
  # define _(args) ()
  #endif

Given this, if I have:

  void foo _(int x);

then on an old compiler, this becomes:

  void foo ();

and on a newer compiler, it becomes:

  void foo (int x);

I'm surprised that I cannot find a entry in the comp.lang.c FAQ to point
you to.

Paul