Nark
Nark

Reputation: 320

Auto formatting - Eclipse C++

Hi all I'm trying to stop the auto formatting in eclipse from indenting my opening and close brace after a function that has a throw() statement on the end.

e.g

void function(std::string param) throw()
{

}

after auto format will look like this:

void function(std::string param) throw()
  {

  }

But it will carry on adding another tab to the front of the brackets every time I autoformat my code. Anyone know how I can turn this feature off, or is it a bug

Eclipse info: Version: Juno Release Build id: 20120614-1722 using CDT

Note: I am using my own code style profile.

Upvotes: 4

Views: 13582

Answers (2)

masoud
masoud

Reputation: 56509

The name of that style is Whitesmiths - Try to change it to Allman.

In C/C++ perspective mode, Goto Window > Preferences > C/C++ > Code Style

enter image description here

Choose BSD/Allman or whatever you want.

Upvotes: 5

stdcall
stdcall

Reputation: 28900

You might want to consider Astyle, this is a eclipse plguin, an interface to a wondeful code beautyfication command line tool. you can set the indentation, formatting, etc. Very handy tool.

Upvotes: 1

Related Questions