[#3726] Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...>

Hi --

15 messages 2004/11/12
[#3749] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3751] Re: Fixnum#clone and Float#clone raise different exceptions — Yukihiro Matsumoto <matz@...> 2004/11/16

Hi,

[#3752] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3785] The latest 1.8.2 cvs prints parse error when starting extension compiling — Yukihiro Matsumoto <matz@...>

Hi,

13 messages 2004/11/23
[#3787] Re: The latest 1.8.2 cvs prints parse error when starting extension compiling — Johan Holmberg <holmberg@...> 2004/11/23

Converting nil to NULL

From: "Berger, Daniel" <Daniel.Berger@...>
Date: 2004-11-11 16:07:56 UTC
List: ruby-core #3711
Hi all,

I asked this on ruby-talk, but I thought I should ask here as well.

I find I'm often doing something like this:

static VALUE foofoo(int argc, VALUE* argv, VALUE self)
   char* foo;
   VALUE rbFoo;
   ...

   rb_scan_args(argc,argv,"01",&rbFoo);

   if(NIL_P(rbFoo)){
      foo = NULL;
   }
   else{
      foo = StringValuePtr(rbFoo);
   }

   some_C_function(foo);
   return WHATEVER;
}
/* END */

Is there a way to reduce this to a single step?  Can we modify
StringValuePtr() to return NULL if its argument is nil?  Or would that
break too many things?

Regards,

Dan


In This Thread

Prev Next