• 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: NSMakePoint and such - what about memory allocation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMakePoint and such - what about memory allocation?


  • Subject: Re: NSMakePoint and such - what about memory allocation?
  • From: Nicko van Someren <email@hidden>
  • Date: Sat, 22 May 2004 06:23:56 +0100

On 22 May 2004, at 1:56, Jim Witte wrote:

FWIW, this seems to stem from the fact that you don't get any sort of implicit constructor for structs, i.e. you can't embed NSPoint(x, y) in your code... this has annoyed me on hundreds of occasions; I can't even begin to imagine what the creators of C were thinking when they overlooked this.**

So you can't write p = NSMakeLine( NSPoint(50,50), NSPoint(100,100) );

No, you can't, because this is not Java and that's not how we construct things in C or even Objective-C. You can however write:
NSRect r = NSMakeRect( NSMakePoint(50,50), NSMakePoint(100,100));
or
NSRect r = (NSRect) { { 50.0, 50.0}, {100.0, 100.0} };

Which seems to do what was required in the first place.

Nicko
_______________________________________________
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: 
 >NSMakePoint and such - what about memory allocation? (From: Christoffer Lerno <email@hidden>)
 >Re: NSMakePoint and such - what about memory allocation? (From: Jim Witte <email@hidden>)

  • Prev by Date: Re: 'Search field' class yet?
  • Next by Date: NSTask problems with the path
  • Previous by thread: Re: NSPoint and automatic constructor
  • Next by thread: build styles override target settings (was: does not execute on launch)
  • Index(es):
    • Date
    • Thread