LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 671|回复: 4

indent格式化c代码怎么使缩进是4个空格

[复制链接]
发表于 2005-5-11 08:23:20 | 显示全部楼层 |阅读模式
同时我还使用-br -ce选项,格式化后是这样的
If you are using the `-br' option, you probably want to  also  use  the
`-ce'  option.   This  causes  the else in an if-then-else construct to
cuddle up to the immediately preceding `}'.   For  example,  with  `-br
-ce' you get the following:

     if (x > 0) {
         x--;
     } else {
         fprintf (stderr, "...something wrong?\n");
     }
x--和fprintf前有2个空格,它没显示出来
我想使格式化后缩进是4个空格,怎么弄?
发表于 2005-5-11 08:58:11 | 显示全部楼层
indent -i4
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-11 09:48:24 | 显示全部楼层
Post by kj501
indent -i4

awesome,3x
回复 支持 反对

使用道具 举报

发表于 2005-5-11 12:53:52 | 显示全部楼层
默认是几?我一般用-kr -i8,K&R风格,8个字符的缩进
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-11 15:12:42 | 显示全部楼层
Post by albcamus
默认是几?我一般用-kr -i8,K&R风格,8个字符的缩进

默认的common style是gnu的,2个空格。看了-kr更适合我,-i8对我来说太大
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表