sizeofA (Re: C++ compile problems)
sizeofA (Re: C++ compile problems)
- Subject: sizeofA (Re: C++ compile problems)
- From: Allan Odgaard <email@hidden>
- Date: Sat, 26 Jun 2004 04:06:21 +0200
On 25. Jun 2004, at 8:23, Chris Ridd wrote:
int wordsize = sizeof(word)/sizeof(string);
int i;
Style-wise, I'd write 'sizeof(word)/sizeof(word[0])' in case I ever
change
what type the word array holds, but it doesn't really matter.
or #include <c.h> and use "sizeofA(word)".
% grep -B1 -A1 sizeofA /usr/include/c.h
* 23-Apr-81 Mike Accetta (mja) at Carnegie-Mellon University
* Added "sizeofS" and "sizeofA" macros which expand to the size
* of a string constant and array respectively.
--
#define sizeofS(string) (sizeof(string) - 1)
#define sizeofA(array) (sizeof(array)/sizeof(array[0]))
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.