Code style

Hi,

I have a number of questions regarding the code style.

  • How do I specify that access identifiers in a class definition must be idented by 2 spaces and that the subsequent members must be indented by 2 extra spaces, ie. 4 in total ?
  • What is "Continuation indent" ?
  • force closing brace of if/for statement on new line ?
  • how to export the scheme to use it on other computers ?


In general the example code in the settings doesn't seem to always match what I specify. For example setting that the "while" of a do...while must be on a new line is not applied on the code example.

Cheers,
Barth

4 comments
Comment actions Permalink

Hi Barth.

1) Please try to set Settings | Editor | Code style | C/C++ | Tabs and Indents | Indent visibility keywords in class/structure equal to 2 (if you use default Indent equal to 4)
2) You can specify the number of spaces (or tabs if the Use Tab Character check box is selected) to be inserted at the next line in case of a construct break.
3) It is available for For. Please set Settings | Editor | Code style | C/C++ | Wrapping and Braces | Place ')' on new line
4) You can do it via File | Import Settings. Settings.jar will be created.

0
Comment actions Permalink

Hi Anna,

Thank you for your reply.

1) I use an indent of 2 spaces. If I set "Indent" to 2 and "indent visilibilty keywords in class/struct" to 2, then I have :

class Foo
{
  public:
  Foo();

and I want to have

class Foo
{
  public:
    Foo();


2) ok
3) I am talking about the brace not the parenthesis
What I want :
  for (int i = 1, j = 2; i <= j; i++, j--) {
    doSomethingElse();

    }
What i get
  for (int i = 1, j = 2; i <= j; i++, j--){
    doSomethingElse();}

4) Excellent!

thank you
Barth

0
Comment actions Permalink

Barth,

We have the issue about the first case in the tracker already and we are working on it right now.
Could you please specify a definition for doSomethingElse(). Could it be a macro?

0
Comment actions Permalink

Dear Anna,

Thank you, this issue is exactly what I need.Our coding guidelines are based on Google guidelines which require this.

The doSomethingElse could be a macro.

cheers,
Barth

0

Please sign in to leave a comment.