unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: jyqvklioo@googlemail.com
Cc: emacs-devel@gnu.org
Subject: Re: Source Code Formatting Standard Update
Date: Mon, 14 Sep 2009 17:42:57 -0400	[thread overview]
Message-ID: <jwvskep436g.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <200909142100.13471.jyqvklioo@googlemail.com> (jyqvklioo@googlemail.com's message of "Mon, 14 Sep 2009 21:00:12 +0200")

> "
> 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	other threads:[~2009-09-14 21:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 19:00 Source Code Formatting Standard Update jyqvklioo
2009-09-14 21:42 ` Stefan Monnier [this message]
2009-09-15 15:12   ` Richard Stallman
2009-09-16 11:56 ` jyqvklioo
2009-09-16 12:13   ` Alfred M. Szmidt
2009-09-16 13:33     ` jyqvklioo
2009-09-16 13:52       ` Alfred M. Szmidt
2009-09-16 14:08       ` Miles Bader
2009-09-16 13:57   ` Stephen J. Turnbull
  -- strict thread matches above, loose matches on Subject: below --
2009-09-15  5:53 jyqvklioo
2009-09-15  7:31 jyqvklioo
2009-09-15  7:39 ` Alfred M. Szmidt
2009-09-15  8:03   ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvskep436g.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=jyqvklioo@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).