Re: -Wstrict-prototypes for extensions

From: nobu.nokada@...
Date: 2004-05-25 02:47:36 UTC
List: ruby-core #2943
Hi,

At Tue, 25 May 2004 10:39:56 +0900,
Jeff Mitchell wrote in [ruby-core:02942]:
> > > -#define ANYARGS
> > > +# ifdef RUBY_STRICT_PROTOTYPES
> > > +#  define ANYARGS void
> > > +# else
> > > +#  define ANYARGS
> > > +# endif
> > >  #endif
> > 
> > ANYARGS doesn't always mean that the function takes no
> > arguments.
> 
> The 'void' is only there to satisfy -Wstrict-prototypes, which
> does not allow VALUE (*)() but will allow VALUE (*)(void).
> 
> Arguments to rb_define_method() and such naturally must be
> casted to VALUE (*)(void).  This is a small price for the
> benefit of -Wstrict-prototypes.  Unless there is some other
> way to suppress these warnings (I wasn't able to find an
> appropriate pragma).

Sorry, but I can't get your point.

At first, your example in [ruby-core:02938] shouln't be like
this?  It doesn't seem to be concerned with ruby.h.

  double f(void)
  {
      return 99.0 ;
  }
  int main(void)
  {
      int a = f() ;
      /* ------> a contains junk <------ */
      printf("%d\n", a) ;
  }

-- 
Nobu Nakada

In This Thread