emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Source Code Formatting Standard Update


From: Stefan Monnier
Subject: Re: Source Code Formatting Standard Update
Date: Mon, 14 Sep 2009 17:42:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> "
> http://www.gnu.org/prep/standards/html_node/Formatting.html
> 5.1 Formatting Your Source Code
> It is important to put the open-brace that starts the body of a 
> C function in column one, so that they will start a defun.
> "
> Does Emacs still have this limitation?
> If not, the standard can be updated to make the curly brace placement
> more consistent.

AFAIK, the standard was not designed like this because of Emacs's
limitations, but because it was considered a good habit.
I don't think this consideration has changed.

> "
> In Standard C, if the arguments don't fit nicely on one line, split it like 
> this:
>      int
>      lots_of_args (int an_integer, long a_long, short a_short,
>                    double a_double, float a_float)
> "
> This practice produces poor results in languages with highly nested
> namespaces, like object oriented languages.  There you can get code
> like:

> namespace.ClassName.NestedClass.nicelyDescriptiveClassName.staticMethod(namespace.ParameterObject
>                                                                         a,
>                                                                         
> otherNamespace.secondObject
>                                                                         b);

Obviously, this is unreadable, so you should write it differently.
But if the alternatives are worse for one reason or another, the right
way to do it is to place a line break after the open-paren.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]