Complete.Org: Mailing Lists: Archives: freeciv-ai: November 2004:
[freeciv-ai] Re: (PR#10203) Greedy CM algorithm
Home

[freeciv-ai] Re: (PR#10203) Greedy CM algorithm

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [freeciv-ai] Re: (PR#10203) Greedy CM algorithm
From: "Benoit Hudson" <bh@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Nov 2004 09:43:39 -0800
Reply-to: rt@xxxxxxxxxxx

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

On Tue, Nov 16, 2004 at 09:49:58PM -0800, Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10203 >
> Using a cast is unnecessary with a void value, and may disguise an error
> if you accidentally cast the wrong thing (since generally you can cast
> anything).  Casts are to be avoided.  However not using a cast here is a
> bit ugly, as you see.

Three ideas:
- we can make a special-case in the coding conventions here
- or we can use an extra temporary:
        const foo *const *pa = va;
        const foo *a = *pa;
- or we can write wrappers around qsort with specvec-like macros so
  everything's type-safe.

Probably the last option's the best, but that's future work.


> > I thought this was a gcc extension:
> > +  bool marked[lattice->size];
> 
> Not anymore.  It is part of C99, we have a configure check for it, and
> it's used elsewhere in the code.

Rock on!  I'll have to start using that :)


> Here is a new patch.  I would like more comments, but I don't think I'm
> up for writing them.  If we are to use this in 2.0 this needs to be
> tested out and put into the code ASAP.

I don't have time to look this over right now; if it's down to comments,
I say commit and we can all propose fixes later.

        -- Benoît





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