• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
sizeofA (Re: C++ compile problems)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: C++ compile problems (From: Chris Ridd <email@hidden>)

  • Prev by Date: Re: Problem building kext's for 10.1.5
  • Next by Date: Re: Code completion lookup crash
  • Previous by thread: Re: C++ compile problems
  • Next by thread: C++ compile problems
  • Index(es):
    • Date
    • Thread