• 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
Re: Malloc()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Malloc()
      • From: Dan Crevier <email@hidden>
    • Re: Malloc()
      • From: Jim Correia <email@hidden>
References: 
 >Re: Malloc() (From: Pete Yandell <email@hidden>)

  • Prev by Date: Re: Statically linking a lib ...
  • Next by Date: Re: How to get objects to not be encoded with NSArchiver
  • Previous by thread: Re: Malloc()
  • Next by thread: Re: Malloc()
  • Index(es):
    • Date
    • Thread