Re: Malloc()
Re: Malloc()
- Subject: Re: Malloc()
- From: Chris Hanson <email@hidden>
- Date: Tue, 2 Apr 2002 18:22:13 -0600
At 5:21 PM +1000 4/2/02, Pete Yandell wrote:
As a counterexample, sizeof will do the right thing for statically
allocated data, so if you declare buffer as:
char buffer[129];
then sizeof(buffer) will give you the expected 129 because the
compiler will know the size at compile time when sizeof is evaluated.
I *never* use the sizeof operator on a variable, because the type the
compiler thinks the variable is isn't always the type the programmer
thinks the variable is. I only ever use the sizeof operator on a
type, because that will do the right thing in all cases.
-- Chris
--
Chris Hanson | Email: email@hidden
bDistributed.com, Inc. | Phone: +1-847-372-3955
Mac OS X & WebObjects Consulting | Fax: +1-847-589-3738
http://bdistributed.com/ | Personal Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: Malloc() (From: Pete Yandell <email@hidden>) |