[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SIZEOF macro
From: |
Bruno Haible |
Subject: |
Re: SIZEOF macro |
Date: |
Fri, 25 Dec 2009 00:43:55 +0100 |
User-agent: |
KMail/1.9.9 |
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
> rename the macro in macros.h to ARRAY_CARDINALITY
No, please not. The name ARRAY_CARDINALITY is, while technically correct,
too technocratic and too long.
- "Cardinality"? Ah, you mean the number of elements!
- 17 characters long? That forces a line break in nearly every for()
loop header in which it is used.
The macro SIZEOF is handy and is common knowledge. Search for it on Google [1]:
you find about 1000 definitions of it, in various packages. Whereas
ARRAY_CARDINALITY [2] occurs only in gnulib, coreutils, tar, and patch. In
other words, people looking at source code that uses SIZEOF will likely
recognize an old friend.
Bruno
[1]
http://www.google.com/codesearch?as_q=define%5CsSIZEOF%5C%28&btnG=Code+suchen&hl=en&as_lang=c&as_license_restrict=i&as_license=&as_package=&as_filename=&as_case=y
[2]
http://www.google.com/codesearch?hl=en&lr=&q=define%5CsARRAY_CARDINALITY%5C%28+lang%3Ac&sbtn=Suche
- Re: SIGNATURE_CHECK, (continued)
- 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, 2009/12/25
- Re: SIZEOF macro, Jim Meyering, 2009/12/25
- Re: SIZEOF macro, Ben Pfaff, 2009/12/24
- Re: SIZEOF macro,
Bruno Haible <=
- 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