[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SIZEOF macro
From: |
Jim Meyering |
Subject: |
Re: SIZEOF macro |
Date: |
Fri, 25 Dec 2009 11:44:19 +0100 |
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, 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
>> rename the macro in macros.h to ARRAY_CARDINALITY, adjust all callers, and
>> to simplify test-argv-iter?
>
> Like this? It's also pretty quick to go with a shorter name of CARDINALITY:
Good compromise.
> for f in `git grep -l ARRAY_CARDINALITY tests`; do \
> sed -i 's/ARRAY_CARDINALITY/CARDINALITY/' $f
> done
Not that the above is terribly slow, but on certain systems
where forking is expensive, you might appreciate avoiding
nearly all of those fork/exec pairs:
git grep -l ARRAY_CARDINALITY tests \
| xargs perl -pi -e 's/ARRAY_CARDINALITY/CARDINALITY/'
> 2009-12-24 Eric Blake <address@hidden>
>
> tests: rename SIZEOF to ARRAY_CARDINALITY
> * tests/macros.h (SIZEOF): Rename...
> (ARRAY_CARDINALITY): ...to this.
> * tests/test-argv-iter.c (ARRAY_CARDINALITY): Delete.
> * tests/test-hash.c (ARRAY_CARDINALITY): Likewise.
> * tests/test-array_list.c: Prefer ARRAY_CARDINALITY over SIZEOF.
> * tests/test-array_oset.c: Likewise.
- Re: ASSERT and SIGNATURE_CHECK macros, (continued)
- Re: ASSERT and SIGNATURE_CHECK macros, Eric Blake, 2009/12/23
- Re: ASSERT and SIGNATURE_CHECK macros, Eric Blake, 2009/12/24
- Re: ASSERT and SIGNATURE_CHECK macros, Jim Meyering, 2009/12/24
- Re: SIGNATURE_CHECK, Bruno Haible, 2009/12/24
- Re: SIGNATURE_CHECK, Eric Blake, 2009/12/24
- Re: SIGNATURE_CHECK, Bruno Haible, 2009/12/24
- Re: SIGNATURE_CHECK, Eric Blake, 2009/12/24
- Re: ASSERT macro, Bruno Haible, 2009/12/24
- SIZEOF macro (was: ASSERT macro), Eric Blake, 2009/12/24
- Re: SIZEOF macro, Eric Blake, 2009/12/24
- Re: SIZEOF macro,
Jim Meyering <=
- Re: SIZEOF macro, Jim Meyering, 2009/12/25
- Re: SIZEOF macro, Ben Pfaff, 2009/12/24
- Re: SIZEOF macro, Bruno Haible, 2009/12/24
- Re: SIZEOF macro, Pádraig Brady, 2009/12/24
- Re: SIZEOF macro, Bruno Haible, 2009/12/25
- Re: SIZEOF macro, Eric Blake, 2009/12/25
- Re: SIZEOF macro, Bruno Haible, 2009/12/26
- Re: ASSERT macro, Eric Blake, 2009/12/26
- Re: ASSERT macro, Bruno Haible, 2009/12/26