Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: [FreeCiv-Cvs] rfalke: Cleanup: replace "sizeof(x)/size
Home

[Freeciv-Dev] Re: [FreeCiv-Cvs] rfalke: Cleanup: replace "sizeof(x)/size

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [FreeCiv-Cvs] rfalke: Cleanup: replace "sizeof(x)/sizeof(x[0])" wi...
From: Justin Moore <justin@xxxxxxxxxxx>
Date: Sat, 8 Sep 2001 18:43:58 -0400 (EDT)

> > > consensus. So I just applied it. If you find the name wrong lets
> > > discuss this in a long thread and IF there is a consensus you have
> > > just to s/ARRAY_SIZE/ARRAY_LEN/.
> >
> >    I actually agree with Gaute on this one.  Size is something that gets
> > passed to malloc, and length is the number of elements in an array.  I
> > would see ARRAY_SIZE as:
> >
> > #define ARRAY_SIZE(x) sizeof(x)
> >
> > where 'x' just happens to be, well, an array. :)
> >
> > -jdm (also hoping this won't turn into another prolonged discussion)
>
> IMHO NR_ITEMS(x) or ARRAY_ELEMENTS(x) is better than "size" or
> "length".

   Or ARRAY_NUM_ELEMENTS works for me, too. :)

-jdm (trying to be diplomatic here)

Department of Computer Science, Duke University, Durham, NC 27708-0129
Email:  justin@xxxxxxxxxxx



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