all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* The indentation of `enum' in the default `gnu' CC Mode style is wrong.
@ 2014-03-03 21:26 Alan Mackenzie
  2014-03-03 22:30 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Mackenzie @ 2014-03-03 21:26 UTC (permalink / raw
  To: emacs-devel; +Cc: Xue Fuqiao

Hi, Emacs.

This was pointed out recently by Xue Fuqiao on bug-cc-mode.

Emacs indents enum definitions as follows:

enum cardsuit
  {
    SPADES,
    HEARTS,
    DIAMONDS,
    CLUBS
  };

.  This is wrong.  According to the GNU Coding Standards chapter
"Formatting Your Source Code", the braces should be in column zero, just
like they are for structs and unions.

This bug goes back into ancient history.  As far as I can make out, it
was introduced into CC Mode on 1993-12-21.

My feeling about this is that the bug should not be fixed, since it
would likely cause creeping indentation changes throughout the GNU code
base for years to come.  What do other people think?

It goes to show how seriously people take coding standards.  ;-).

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: The indentation of `enum' in the default `gnu' CC Mode style is wrong.
  2014-03-03 21:26 The indentation of `enum' in the default `gnu' CC Mode style is wrong Alan Mackenzie
@ 2014-03-03 22:30 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2014-03-03 22:30 UTC (permalink / raw
  To: Alan Mackenzie, emacs-devel; +Cc: Xue Fuqiao

This bug has bothered me on occasion, and I'd like it if it were fixed.  
The unnecessary indentation sometimes causes extra lines, e.g.,

  enum
    {
       SYSTEM_BITS = (FOO_BIT | BAR_BIT
                      | BAZ_BIT),
       USER_BITS = ~ SYSTEM_BITS
    };

where the SYSTEM_BITS definition would fit on one line were it not for 
the unnecessary indentation.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-03 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-03 21:26 The indentation of `enum' in the default `gnu' CC Mode style is wrong Alan Mackenzie
2014-03-03 22:30 ` Paul Eggert

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.