MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Mats Kindahl Date:April 6 2009 2:01pm
Subject:Re: coding style change proposal: switch exception
View as plain text  

Michael Widenius wrote:
> Hi!
> 
>>>>>> "Ingo" == Ingo Strüwing <Ingo.Struewing@stripped>
> writes:
> 
> Ingo> Hi,
> Ingo> I propose to get rid of the "switch exception" regarding the opening
> Ingo> brace. I propose to write new code so that the opening brace is put on
> Ingo> its own line below the switch keyword.
> 
> This causes an extra indention and what is worse make the case labels
> for the swith not line up with the switch statement.
> 
> As far as I remmeber, it's a very common C code style to have SWITCH
> and their CASE to start at the same offset.
> 
> When you have switches inside switches the resulting code is, at least
> in my eyes, much harder to read if you indent the case on extra level.
> 
> The reason to put the { on the switch line, was to avoid the 'ugly' case
> where { and following case are on the same offset like in:
> 
>   switch()
>   {
>   case
> 
> Ingo> I suggest to indent the case labels, but this is a much smaller wish. My
> Ingo> proposal shall be taken as accepted even if the indentation suggestion
> Ingo> is refused.
> 
> I prefer the current exception as you get a nice lineup of switch and
> case, which I think is easier to read.

Hi Monty!

When I type the { on a separate line (as above), the case label and the start of
the switch lines up (as in the example above).

I am using Emacs 22 and the mysql style that is in our style guide under
http://forge.mysql.com/wiki/MySQL_Internals_Coding_Guidelines#Suggested_mode_in_emacs

Is that what you saw as the main problem, or did I misunderstood you?

Just my few cents,
Mats Kindahl

> 
> Regards,
> Monty
> 
> --
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe:    http://lists.mysql.com/internals?unsub=1
> 

-- 
Mats Kindahl
Senior Software Engineer
Database Technology Group
Sun Microsystems
Thread
coding style change proposal: switch exceptionIngo Strüwing13 Mar
  • [style] change proposal: switch exceptionKonstantin Osipov17 Mar
    • Re: [style] change proposal: switch exceptionChad MILLER17 Mar
    • re: [style] change proposal: switch exceptionMichael Widenius6 Apr
  • re: coding style change proposal: switch exceptionMichael Widenius6 Apr
    • Re: coding style change proposal: switch exceptionMats Kindahl6 Apr
      • Re: coding style change proposal: switch exceptionMichael Widenius19 Apr
        • Re: coding style change proposal: switch exceptionIngo Strüwing20 Apr