C-C++ mode



next up previous contents index
Next: default mode Up: mode.sc Previous: mode.sc

C-C++ mode

In C-mode and C++mode the key bindings  defined by Smac are:

Indentation  is parameterized by the following global variables:

The indentation rules for an empty line, for instance when you type a return at the end of a line, are (take a deep breath):

The indentation rules, when you indent a non empty line (for instance when you reindent a line with a tab) depend on the first character(s) (jumping space, tab, newline and comments) (cheer up !, we're almost there):

As you can see, it is rather complicated, nevertheless some cases are not taken into account and need braces. For instance it is the case for nested if like:

are poorly indented:

but the indentation is correct with braces:

Of course the quantity of code interpreted by Smac when you type a simple return is rather disturbing, but don't be afraid, Smac is a good boy.



next up previous contents index
Next: default mode Up: mode.sc Previous: mode.sc



Lionel Fournigault
Mon Mar 6 13:33:34 MET 1995