Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: [Review] Re: advdomestic.c cleanup II. (PR#1157)
Home

[Freeciv-Dev] Re: [Review] Re: advdomestic.c cleanup II. (PR#1157)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Petr Baudis <pasky@xxxxxxxxxxx>
Cc: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, Mike Kaufman <mkaufman@xxxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Review] Re: advdomestic.c cleanup II. (PR#1157)
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Mon, 31 Dec 2001 14:26:04 -0500

At 07:20 PM 01/12/31 +0100, Petr Baudis wrote:
>Dear diary, on Mon, Dec 31, 2001 at 12:57:04PM CET, I got a letter,
>where Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> told me, that...
>> While we are talking about line wraps, I thought the accepted wrapping is
>> before an operator, like
>> 
>> if (doodle 
>>     && beeble) {
>>   blah = trrrrr
>>          + frrrr;
>> }
>> 
>> and NOT
>> if (doodle && 
>>     beeble) {
>>   blah = trrrrr + 
>>          frrrr;
>> }
>> 
>> 
>> Yes, distinctly I remember (it was in the bleak November) this topic
>> being discussed and an agreement being reached.  This is how it's done in
>> tech literature anyways.
>Uhm, I don't remember that this was discussed. However I strongly (very very
>strongly ;) dislike your one - it appears just much more messy for me.
What are
>the merits?

For one, it is the original K&R style, and if the gods liked it ... :-).

But splitting the binary operation into an operator and an operand on
separate lines is awkward. Note the original operand is potentially an 
accumulated series of operations, the key addition is the next binary
operation, but it could be anything. Breaking after the initial operand
and before the operator thus allows more flexibility, and fewer code 
lines to change when adding new elements or removing old ones.

Think of the second and subsequent lines as (+= operand) constructs.

It is also the case when lining up the subsequent lines that the operator
acts as an indent flag to clearly mark the continuation as opposed to a 
new action. Stuck on the end it is largely invisible.

Cheers,
RossW
=====

>-- 
>
>                               Petr "Pasky" Baudis
>
>UN*X programmer, UN*X administrator, hobbies = IPv6, IRC, FreeCiv, (e)links
>.
>Firewall in a way is like the doorkeeper of a local pub. If you don't have
your
>I.D. on you, or if for some reason you do not qualify to enter, the
doorkeeper
>will not permit you to enter. In some extreme cases these doorkeepers will
not
>let you out, or at least give you a hard time before they finally let you
out.
>.
>Public PGP key, geekcode and stuff: http://pasky.ji.cz/~pasky/
>
>



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