T
Tristin Davis
[Note: parts of this message were removed to make it a legal post.]
I've been going over the Ruby API and I have a couple questions.
Why are the variables defined outside the block? What effect does this have
on the variables?
static VALUE
fsdbm_s_open(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
VALUE obj = Data_Wrap_Struct(klass, 0, free_sdbm, 0);
if (NIL_P(fsdbm_initialize(argc, argv, obj))) {
return Qnil;
}
if (rb_block_given_p()) {
return rb_ensure(rb_yield, obj, fsdbm_close, obj);
}
return obj;
}
I've always defined my variables inside a block.
static VALUE fsdbm_s_open(argc,argv,self) {
int argc;
VALUE *argv;
VALUE self
/* Etc */
}
I've been going over the Ruby API and I have a couple questions.
Why are the variables defined outside the block? What effect does this have
on the variables?
static VALUE
fsdbm_s_open(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
VALUE obj = Data_Wrap_Struct(klass, 0, free_sdbm, 0);
if (NIL_P(fsdbm_initialize(argc, argv, obj))) {
return Qnil;
}
if (rb_block_given_p()) {
return rb_ensure(rb_yield, obj, fsdbm_close, obj);
}
return obj;
}
I've always defined my variables inside a block.
static VALUE fsdbm_s_open(argc,argv,self) {
int argc;
VALUE *argv;
VALUE self
/* Etc */
}