In C-mode and C++mode the key bindings defined by Smac are:
\_indent\_line function.
\_indent\_line function. It may be necessary to type
tab after some characters modifying the line context (for
instance after case).
c\_insert\_blink\_matched\_char\_and\_indent.
\_indent\_line.
#, }, space, tab and newline, or whose
first two characters are not // or /*, and
whose previous line last char (before newline) is not
\. Obviously the beginning of the buffer is also
considered to be a definition beginning. Made by the function
goto\_beginning\_of\_c\_definition.
{,(,[
or " it goes after the corresponding },),] or ", else it goes to the end of the
following word. A word contains alphabetic characters,
digits and underscore. Made by the forward\_c\_form
function.
\_c\_form function.
\_next\_c\_form function.
delete\_previous\_c\_form.
\_indent\_region function.
Indentation is parameterized by the following global variables:
\_indent\_in\_comment (default
value 3)
\_indent\_in\_string (default
value 0)
\_indent\_in\_parenthesis
(default value 1)
\_indent\_in\_bracket (default
value 1)
\_indent\_in\_brace (default
value 2)
\_indent\_in\_statement (default
value 2)
\_arg\_decl\_indent (default
value 4)
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):
/*' position plus the
absolute value of c\_indent\_in\_comment. A
comment begins with `/*' and ends with `*/',
and a C++ comment with `//' and ends at the end of
line.
\_indent\_in\_string is less than 0 the
indentation is the string beginning position minus c\_indent\_in\_string (so plus its absolute
value), otherwise indentation equals c\_indent\_in\_string.
\_indent\_in\_parenthesis.
\_indent\_in\_bracket.
{}), all depends
on the previous character (skipping space, tab,
newline and comments):
\_indent\_in\_brace.
`.' or `;', indentation
is set to the previous expression indentation.
\_indent\_in\_statement.
\_indent\_in\_statement.
\_arg\_decl\_indent because it is probably
the parameters of a function written with the old
syntax.
`;', indentation is set to
previous expression indentation.
\_indent\_in\_statement,
elsewhere 0.
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):
#', indentation is set to 0.
*' and the next character is
`/', so you close a comment, indentation is set
to the indentation of the `/*'
`:', indentation is set to the
indentation of the corresponding `?'.
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.