bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: CC Mode 5.28 (C); struct braces are not indented in GNU style


From: John Darrington
Subject: Re: CC Mode 5.28 (C); struct braces are not indented in GNU style
Date: Thu, 14 Dec 2006 11:20:35 +0900
User-agent: Mutt/1.5.13 (2006-08-11)

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: signature.asc
Description: Digital signature


reply via email to

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