Snowcrash
Snowcrash

Reputation: 86187

Ruby - source code - coding style

Looking through the Ruby code it has the following for proc_arity:

static VALUE
proc_arity(VALUE self)
{
    int arity = rb_proc_arity(self);
    return INT2FIX(arity);
}

More of a C coding style question really but why is static VALUE on a separate line instead of something like this:

static VALUE proc_arity(VALUE self)

Upvotes: 5

Views: 142

Answers (1)

ouah
ouah

Reputation: 145879

It comes from the UNIX world, because it helps to easily grep the definition of a function:

$ grep -n '^proc_arity' *.c

or using vim:

/^proc_arity

Upvotes: 10

Related Questions