加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

有人能告诉我我的C缩进样式是否被命名? (给出的例子)

发布时间:2020-12-16 09:27:01 所属栏目:百科 来源:网络整理
导读:我正在学习C语言.对我来说,我的编程风格看起来最好;它似乎没有遵循任何一种特定风格的规则.这是一个例子 void f(int x){ //no space between close-paren and bracket if (!x){ cout "x is non-zeron"; } //closing bracket indented to the same level as
我正在学习C语言.对我来说,我的编程风格看起来最好;它似乎没有遵循任何一种特定风格的规则.这是一个例子

void f(int x){ //no space between close-paren and bracket
    if (!x){
        cout << "x is non-zeron";
    } //closing bracket indented to the same level as the original statement
}

对于像类或命名空间这样的东西,它只是略有不同:

class myClass {}; //space between class name and bracket,otherwise the same as functions

K& R风格确实使用了那种包围语句,但我的风格将它用于一切.我想知道它是否有一个名称,所以我可以简单地说出我的缩进样式,而不必使用这些例子来解释.

解决方法

看起来BSD KNF风格.见 http://en.wikipedia.org/wiki/Indent_style

(注意,它也是我喜欢的风格:))

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读