[Freeciv-Dev] Re: (PR#7369) [RFC] Coding style
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7369 >
On Mon, Feb 02, 2004 at 02:56:38AM -0800, Raimar Falke wrote:
>
> > On further reflection I agree with Per: rather than single versus
> > multi-line expressions it should be variables versus expressions.
>
> Here you step into a mine field. First a variable is also an
> expression (in the language definition). But I understand you. So what
> expressions and operators are allowed? What about
> return a->b[c].d->e[f].g.h;
> return masked == to_test_for;
> return TEST_BIT(pcity->city_options, option);
> return unit_buy_gold_cost(to, unit_disband_shields(from));
I do _not_ support the mandate of parentheses on any type of return
statements. I don't like parentheses on single expression return
statements because it confuses the return statement for a function call.
I will occasionally code parentheses around complicated expressions. So a
codification of my preference would look like:
return (p); /* not allowed */
return (p && q && !r); /* optional based on readability of code */
>
> A related issue is:
> foo += bar / 2;
> vs
> foo += (bar / 2);
codifying this is silly.
-mike
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style, Jason Short, 2004/02/02
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style, Raimar Falke, 2004/02/02
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style, Per I. Mathisen, 2004/02/02
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style, Jason Short, 2004/02/02
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style, Raimar Falke, 2004/02/02
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style,
Mike Kaufman <=
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style, Gregory Berkolaiko, 2004/02/02
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style, Vasco Alexandre da Silva Costa, 2004/02/02
- [Freeciv-Dev] Re: (PR#7369) [RFC] Coding style, Vasco Alexandre da Silva Costa, 2004/02/02
|
|