Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7369) [RFC] Coding style
Home

[Freeciv-Dev] Re: (PR#7369) [RFC] Coding style

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: i-freeciv-lists@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style
From: "Jason Short" <jshort@xxxxxxxxxxxxxx>
Date: Mon, 2 Feb 2004 00:33:45 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7369 >

>
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7369 >
>
>
> We currently have both
>
> int foo()
> {
>   return p->bar;
> }
>
> and
>
> int foo()
> {
>   return (p->bar);
> }
>
> Can we change to coding style so that one is preferred?

Between these, I prefer

  return p->bar;

However, in more complicated statements I prefer

  return (some_random_lengthy_value_number_one()
          && some_random_lengthy_value_number_two());

over

  return some_random_lengthy_value_number_one()
    && some_lengthy_random_value_number_two();

Note that the first is formatted "properly" according to the style guide
(and most editors will give you this).  AFAIK the style guide does not
specify a formatting for the second (and editors may be inconsistent).

So my preference would be: no-parenthesis for single-line, parenthesis for
multi-line.

jason




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