Re: SIZEOF macro

2009-12-26 Thread Bruno Haible
Eric Blake wrote: > Is there some other short but acceptable name? Maybe COUNTOF or > ARRAY_COUNT? END_INDEX or LAST_INDEX? I don't see a better name than SIZEOF: - The terms "length", "count", "used" etc. allude to the used portion of an array, not its allocated size. - "cardinality" is

Re: SIZEOF macro

2009-12-25 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 12/25/2009 3:58 AM: > Pádraig Brady wrote: >> I use LENGTHOF in my personal code. > > It's certainly handy and easy to remember. But in C we often make the > distinction between "length" (= number of elements that matter)

Re: SIZEOF macro

2009-12-25 Thread Jim Meyering
Jim Meyering wrote: > Eric Blake wrote: >> According to Eric Blake on 12/24/2009 4:21 PM: >>> According to Bruno Haible on 12/24/2009 1:08 PM: >> Either way we create macros.h and put ASSERT there Done this this big commit, now. >>> >>> Hmm. macros.h defines SIZEOF, and test-argv-iter.c d

Re: SIZEOF macro

2009-12-25 Thread Bruno Haible
Pádraig Brady wrote: > I use LENGTHOF in my personal code. It's certainly handy and easy to remember. But in C we often make the distinction between "length" (= number of elements that matter) and "size" (= number of elements for which room is allocated). The array L"abc" has length 3, as determin

Re: SIZEOF macro

2009-12-25 Thread Jim Meyering
Eric Blake wrote: > According to Eric Blake on 12/24/2009 4:21 PM: >> According to Bruno Haible on 12/24/2009 1:08 PM: > Either way we create macros.h and put ASSERT there >>> Done this this big commit, now. >> >> Hmm. macros.h defines SIZEOF, and test-argv-iter.c defines >> ARRAY_CARDINALITY

Re: SIZEOF macro

2009-12-24 Thread Pádraig Brady
On 24/12/09 23:21, Eric Blake wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 12/24/2009 1:08 PM: Either way we create macros.h and put ASSERT there Done this this big commit, now. Hmm. macros.h defines SIZEOF, and test-argv-iter.c defines ARRAY_CARDINALIT

Re: SIZEOF macro

2009-12-24 Thread Bruno Haible
Eric Blake wrote: > macros.h defines SIZEOF, and test-argv-iter.c defines > ARRAY_CARDINALITY, both of which are used to determine the size of an > array. I kind of prefer the name in test-argv-iter (to me, sizeof implies > a size_t count of bytes, not the number of elements). Is it okay to > ren

Re: SIZEOF macro

2009-12-24 Thread Ben Pfaff
Eric Blake writes: > Hmm. macros.h defines SIZEOF, and test-argv-iter.c defines > ARRAY_CARDINALITY, both of which are used to determine the size of an > array. I kind of prefer the name in test-argv-iter (to me, sizeof implies > a size_t count of bytes, not the number of elements). Is it okay

Re: SIZEOF macro

2009-12-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 12/24/2009 4:21 PM: > According to Bruno Haible on 12/24/2009 1:08 PM: Either way we create macros.h and put ASSERT there >> Done this this big commit, now. > > Hmm. macros.h defines SIZEOF, and test-argv-iter.c defines

SIZEOF macro (was: ASSERT macro)

2009-12-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 12/24/2009 1:08 PM: >>> Either way we create macros.h and put ASSERT there > > Done this this big commit, now. Hmm. macros.h defines SIZEOF, and test-argv-iter.c defines ARRAY_CARDINALITY, both of which are used to deter