• 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: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare


  • Subject: Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
  • From: Chris Suter <email@hidden>
  • Date: Wed, 28 Jan 2009 10:23:23 +1100

Hi Graham,

On Wed, Jan 28, 2009 at 10:07 AM, Graham Cox <email@hidden> wrote:

> It's a good habit IMO to always
> take the address in these cases to make it clear in your code what your
> intentions were when you wrote it.

I'm afraid I have to disagree with this approach.

In my opinion, it's more likely that you might change:

    uint8_t buffer[5];

to:

    uint8_t *buffer = (uint8_t *)malloc (size);

(Or something like it.)

In which case using & later is then going to cause it to break.

Arrays are more like pointers than any other type so I prefer to treat
them that way. I think the fact that &array == array is a source of
confusion and I wish they didn't allow it (the use of &array that is).

-- Chris
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
      • From: Graham Cox <email@hidden>
References: 
 >Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare (From: William Jon Shipley <email@hidden>)
 >Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare (From: Adam Venturella <email@hidden>)
 >Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare (From: Jeremy Pereira <email@hidden>)
 >Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
  • Next by Date: Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
  • Previous by thread: Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
  • Next by thread: Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare
  • Index(es):
    • Date
    • Thread