Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] Re: (PR#7075) break and continue in iterators
Home

[Freeciv-Dev] Re: (PR#7075) break and continue in iterators

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: a-l@xxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7075) break and continue in iterators
From: "Jason Short" <jshort@xxxxxxxxxxxxxx>
Date: Sun, 4 Jan 2004 15:08:33 -0800
Reply-to: rt@xxxxxxxxxxx

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

Arnstein Lindgard wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7075 >
> 
> "break" inside iterate_outward{} doesn't work. Maybe not surprising
> since the macro uses a for() loop inside a while() loop. Sometimes
> "break" has the effect of a "continue", and that took a deliberate
> effort to detect. This can easily become hard to find bugs for the
> unwary.
> 
> If "goto" is perfectly valid C, less ambigous and equally well
> defined as "break", then what exactly are the reasons for
> discouraging it's use?

Goto is less elegant and breaks some other code (like list iterators). 
But the worst is to force the use of break in some places and the use of 
goto in others.

I agree with Ross: the iterator should be rewritten to use a single loop.

jason




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