3

In C++ mode there is the following behavior of the indentation:

enter image description here

Why is this happening? How can I fix it?

1 Answer 1

6

It's not weird; std: could be a label and until you type the second : it doesn't know otherwise.

Edit: I forgot to mention, but you can customize c-default-style to choose a different indentation style, and you can add your own entries to c-style-alist to make one that's exactly to your liking.

2
  • As there is indentation of 4 spaces shouldn't everything - label or not - be placed in 4 spaces?
    – Adam
    Commented Mar 22, 2016 at 23:06
  • 1
    Labels aren't indented in any of the default indentation styles (see the c-style-alist variable) except the "java" style.
    – db48x
    Commented Mar 22, 2016 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.