Re: (PR#10203) Greedy CM algorithm

"Benoit Hudson" <bh-0/DuvcfrMH9wGe/[email protected]> Wed, 17 Nov 2004 09:43:39 -0800
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<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