/u/a1/.env/.Emacs)
int example_align(char *str)
{
int i;
for (i = 0; i < 4; ++i)
if (i > 2)
return 1;
return 0;
}
{, } ou une
structure de contrôle. On indente une première fois pour les
accolades, puis une seconde pour leur contenu.
if (cp) return cp; => Incorrect
if (cp) {return cp;} => Incorrect
if (cp) => Correct
{
return cp;
}
if (cp) => Correct
{
return cp;
}
int example_foo(char c)
{
int i;
for (i = 0; i < 42; ++i)
;
return i;
}
/*
** this function is useless
*/
void example_foo(void)
{
return;
}
**.
/*
** Comment => Correct
*/
/*
* Comment => Incorrect
*/
void example_func(struct s_list *p1, struct s_tree *p2)
{
}
et si cela dépasse les 79 colonnes:
void example_func(struct s_list *p1,
struct s_tree *p2,
struct s_double_list *p3)
{
}
en respectant l'alignement par tabulations (avec M-i dans Emacs).
void example_foo() => Incorrect
{
}
void example_foo(void) => Correct
{
}