unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: John Darrington <jmd@csse.uwa.edu.au>
Cc: bug-cc-mode@gnu.org, bug-gnu-emacs@gnu.org
Subject: Re: CC Mode 5.28 (C); struct braces are not indented in GNU style
Date: Thu, 14 Dec 2006 11:20:35 +0900	[thread overview]
Message-ID: <20061214022035.GA31435@csse.uwa.edu.au> (raw)
In-Reply-To: <E1Gprtz-0006gD-Is@fencepost.gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 1249 bytes --]

On Thu, Nov 30, 2006 at 02:48:59PM -0500, Richard Stallman wrote:
>     GNU coding standards say: 
>      "It is important to put the open-brace that starts the body of a C
>      function in column one, and avoid putting any other open-brace or
>      open-parenthesis or open-bracket in column one"  
> 
> 
>     But given a code snippet like:
> 
>     struct foobar  
>      {
>       int x;
>      };
> 
>     indent-region reformats it as:
> 
>     struct foobar  
>     {
>       int x;
>     };
> 
>     which is contrary to the second clause of this sentence.
> 
> I don't think the C indentation commands know how to distinguish
> functions from structs.  But perhaps they should not alter
> the indentation of a top-level open-brace.

Braces in a struct initialisation get indented correctly, as in

struct foobar = 
 {
   1,
   2
 };

so it would seem to me, that it wouldn't be too much effort to get

struct foobar
 {
  int x;
  int y;
 };

to indent in the same way.


-- 
John Darrington                                 jmd@csse.uwa.edu.au
University of Western Australia                 http://www.csse.uwa.edu.au/~jmd
PhD Candidate                                   +61 8 6488 4775

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

      reply	other threads:[~2006-12-14  2:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29  4:56 CC Mode 5.28 (C); struct braces are not indented in GNU style John Darrington
2006-11-30 19:48 ` Richard Stallman
2006-12-14  2:20   ` John Darrington [this message]

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=20061214022035.GA31435@csse.uwa.edu.au \
    --to=jmd@csse.uwa.edu.au \
    --cc=bug-cc-mode@gnu.org \
    --cc=bug-gnu-emacs@gnu.org \
    /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).