【问题标题】:Ruby - source code - coding styleRuby - 源代码 - 编码风格
【发布时间】:2013-06-13 22:00:06
【问题描述】:

查看 Ruby 代码,proc_arity 有以下内容:

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

更多的是一个 C 编码风格的问题,但为什么 static VALUE 在单独的一行而不是这样的:

static VALUE proc_arity(VALUE self)

【问题讨论】:

    标签: c ruby coding-style


    【解决方案1】:

    它来自 UNIX 世界,因为它有助于轻松地grep 定义一个函数:

    $ grep -n '^proc_arity' *.c
    

    或使用vim:

    /^proc_arity
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多