2

I used astyle to format my C/C++ source codes, after many tries, it almost satisfied my need except that it added extra indent after the clause extern "c" {.

I find that astyle has this feature here, it says "The C/C++ keyword 'extern' no longer causes an extra indent.", but do not find the option in its documentation.

I am using astyle 2.02.

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
whatacold
  • 660
  • 7
  • 15
  • it seems that there are few people using astyle, sign -- just another question, how to make just one tab indent of the second line for a two-line statement? – whatacold Dec 31 '11 at 05:00

2 Answers2

1

this issue was fixed some time ago, check out this bug link of AStyle:

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

whatacold
  • 660
  • 7
  • 15
0

It appears this is an open issue, see http://sourceforge.net/tracker/index.php?func=detail&aid=1514844&group_id=2319&atid=102319 for details.

That issue describes a potential workaround, however it requires modification of your source code:

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

void func1();

#if 0
{
#endif
#ifdef __cplusplus
}
#endif
DRH
  • 7,868
  • 35
  • 42