【问题标题】:How to avoid extra 'extern' indent如何避免额外的“外部”缩进
【发布时间】:2012-01-26 18:43:42
【问题描述】:

我使用astyle格式化我的C/C++源代码,经过多次尝试,它几乎满足了我的需要,除了它在子句extern "c" {之后增加了额外的缩进。

我发现 astyle 有这个功能here,它说“C/C++ 关键字 'extern' 不再导致额外缩进。”,但在其文档中找不到该选项。

我使用的是 astyle 2.02。

【问题讨论】:

  • 好像很少有人用astyle, sign -- 又一个问题,如何让双行语句的第二行只缩进一个tab?

标签: c++ extern indentation astyle


【解决方案1】:

这似乎是一个未解决的问题,有关详细信息,请参阅http://sourceforge.net/tracker/index.php?func=detail&aid=1514844&group_id=2319&atid=102319

该问题描述了一种潜在的解决方法,但它需要修改您的源代码:

#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif

void func1();

#if 0
{
#endif
#ifdef __cplusplus
}
#endif

【讨论】:

    【解决方案2】:

    这个问题前段时间修复了,看看这个AStyle的bug链接:

    http://sourceforge.net/tracker/?func=detail&aid=3467479&group_id=2319&atid=102319

    【讨论】:

    • 此链接已失效。
    猜你喜欢
    • 2011-11-28
    • 1970-01-01
    • 2020-09-09
    • 2016-12-24
    • 1970-01-01
    • 2020-02-10
    • 2016-02-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多