Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Map coordinate cleanups.
Home

[Freeciv-Dev] Re: Map coordinate cleanups.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Marco Colombo <marco@xxxxxx>
Cc: Andreas Kemnade <akemnade@xxxxxxxxxxx>, Gaute B Strokkenes <gs234@xxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Map coordinate cleanups.
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 16 Aug 2001 15:08:14 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Aug 16, 2001 at 01:47:28PM +0200, Marco Colombo wrote:
> On Thu, 16 Aug 2001, Raimar Falke wrote:
> 
> > >  > Maybe it is time to decide which rule freeciv should follow. I would
> > >  > vote for the extra {}s.
> 
> Me too, for what it counts.
> <noflames>
> But I'm on the http://www.linuxhq.com/kernel/v2.4/doc/CodingStyle.html
> side, so I disagree with most of the "Mini Style Guide" section in
> freeciv_hackers_guide.txt.
> Well, only -i2 is real horror, to tell the truth.
> </noflames>

Indeed doesn't the "Mini Style Guide" cover the brace issue.

> > >  > Could this be rewritten to use ffs(3). There is no loop needed.
> > > ffs is not portable. It does not exist on mingw targets and on amigaos.
> > > (without using ixemul.library (unix emulation like cygwin.dll on
> > > windows))
> > >
> > > Or should we put a my_ffs into common/support.c?
> >
> > Yes it looks like a reasonable approach.
> 
> Does it sound reasonable just to call it ffs() as in:
> 
> #if !defined(HAVE_FFS)
> int
> ffs(int i)
> {
>       ...
> }
> #endif
> 
> My man page says ffs() is BSDish. 

> Maybe a __USE_BSD is required with glibc.

At least in my string.h ffs() is surrounded by "#if defined
__USE_BSD". However it looks like this symbol is already defined. So
no problem here.

> I guess the the glibc ffs is optimized on some archs where ASM instructions
> are available to perform the task. But do we really care?

I don't care about performance. I do care about abstraction. So I'm
also happy with a "int log2(int)" method.

> Anyway, I'm not sure one should have my_* functions everytime something
> useful isn't really portable... just my 0.02.

Freeciv prefixes such cases with "my_" or "my" and I have also seen
such prefixes in other code.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "#!/usr/bin/perl -w
  if ( `date +%w` != 1 ) {
    die "This script only works on Mondays." ;
  }"
    -- from chkars.pl by Cornelius Krasel in de.comp.os.linux.misc


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