Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Obj-C Pointer and "Unsigned" weirdness

Obj-C Pointer and "Unsigned" weirdness
Thread Tools
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Jun 20, 2002, 10:48 PM
 
Ok, 2 questions:

1) in NSArray and multiple other examples, methods are defined as follows:

- (unsigned)count
is unsigned an unsigned int? or what?

2) in NSArray and multiple other examples, id refers to...

- (id)lastObject
shouldn't it be:
- (id *)lastObject
since NSArray holds a bunch of pointers... shouldn't it return a pointer? It can't return an object because it contains none.... What's going on?

Thanks in advance.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 20, 2002, 11:59 PM
 
1. Yes, "unsigned" refers to an unsigned int. (It's really rather pragmatic--an array is never going to have less than 0 objects, and it's never going to have half an object.)

2. The data type id is defined as a pointer to an object. You should read Object-Oriented Programming and the Objective-C Language if you're looking to program in Obj-C. In contains a lot of useful information (such as this) that you'll want to know. It's included with the DevTools at /Developer/Documentation/Cocoa/ObjectiveC/index.html.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Jun 21, 2002, 12:40 AM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Chuckit:
<strong>1. Yes, "unsigned" refers to an unsigned int. (It's really rather pragmatic--an array is never going to have less than 0 objects, and it's never going to have half an object.)

2. The data type id is defined as a pointer to an object. You should read Object-Oriented Programming and the Objective-C Language if you're looking to program in Obj-C. In contains a lot of useful information (such as this) that you'll want to know. It's included with the DevTools at /Developer/Documentation/Cocoa/ObjectiveC/index.html.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">thanks chuck.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:27 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2