• 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: 3 obj-c/cocoa beginner q's
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 3 obj-c/cocoa beginner q's


  • Subject: Re: 3 obj-c/cocoa beginner q's
  • From: Chris Ridd <email@hidden>
  • Date: Tue, 25 Mar 2003 13:53:33 +0000

On 25/3/03 1:30 pm, Ben Dougall <email@hidden> wrote:

> _____________________________________________________
> 1.
> this is a bit of code from a book i'm following at the moment. it feels
> like it might possibly be an inefficient way of doing things. but then
> i could easily be wrong:
>
> for (i = 0; i < [myArray count]; i++) {
> ....
> ....
> }
>
> doesn't this mean that the myArray object will get messaged for every
> for loop execution? in other words if the array has 100 elements
> myArray is going to get messaged a 100 times? or doesn't that matter?

Yes, yes, and probably not. The count method is probably very cheap and just
returns a copy of an int ivar. The address of the method will be cached by
Objc-C's dispatcher so it will be pretty cheap to send the message.

> wouldn't defining an int to hold [myArray count] before going into the
> for loop, and using that int in the for loop arguments, therefore only
> messaging myArray once, be a better way to do that? or not?

Yes it would be, at the expense of an extra variable.

> _____________________________________________________
> 2.
> how do i change the commented automatic message in project builder?
> _____________________________________________________

Read the "Expert Preferences Notes".

> 3.
> what's this website all about?: http://www.gnustep.org/

GNUstep is an open-source "clone" of some of the NeXT frameworks that are
now called Cocoa by Apple. It is an incomplete clone, but I'm sure they'd
welcome patches :-)

> thing that puzzles me about it is it's all about objective-c and yet
> there seems to be some contradictions to some fundamental stuff i've
> read in my recent os x/cocoa/obj-c learning. eg: somewhere in the
> introduction to objective-c on that site it mentions the #import
> preprocessor function and says it's deprecated - works but shouldn't be

That is because the normal version of gcc considers it deprecated. Apple's
version of gcc continues to support it.

> used in new code. ? i get the feeling it's not geared at all towards os
> x cocoa. but then objective-c's objective-c. shouldn't make too much
> difference? also it covers NSThings - i sort of had it in mind that
> NSThings are fairly specific to os x. does this mean that objective-c
> code written to use NSThings, the cocoa framework, will work on other
> platforms? if so, which ones?

It will mean that it should be *relatively* easy to port a Cocoa app to any
platform that GNUstep supports.

Cheers,

Chris
_______________________________________________
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: 
 >3 obj-c/cocoa beginner q's (From: Ben Dougall <email@hidden>)

  • Prev by Date: 3 obj-c/cocoa beginner q's
  • Next by Date: Re: 3 obj-c/cocoa beginner q's
  • Previous by thread: 3 obj-c/cocoa beginner q's
  • Next by thread: Re: 3 obj-c/cocoa beginner q's
  • Index(es):
    • Date
    • Thread