bug-gnulib
[Top][All Lists]
Advanced

[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 11:58:19 +0100
User-agent: KMail/1.9.9

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 determined by wcslen, but has storage
allocated for 4 elements.

See also the fields 'size' and 'length' in lib/linebuffer.h.

I like the name SIZEOF also because it gets this distinction right.

Bruno




reply via email to

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