New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

What Are All of the Objective-C Primitive Types?

Thread Closed

Thread Tools

Member Since: Jul 15, 2008
Posts: 25
kaydell is on a distinguished road

kaydell is offline
I am working on an exercise in Objective-C to have a complete list of primitive types and to learn how large each primitive type is in Objective-C. I have the following code written. This code shows me the size of each primitive.

Am I missing any Objective-C primitives?

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
	// calculate the sizes of C-Primitives
	int i = 1;
	NSLog(@"Primitive sizes:");
	NSLog(@"%d The size of a char is: %d.", i++, sizeof(char));
	NSLog(@"%d The size of short is: %d.", i++, sizeof(short));
	NSLog(@"%d The size of int is: %d.",  i++, sizeof(int));
	NSLog(@"%d The size of long is: %d.",  i++, sizeof(long));
	NSLog(@"%d The size of long long is: %d.",  i++, sizeof(long long));
	NSLog(@"%d The size of a unsigned char is: %d.",  i++, sizeof(unsigned char));
	NSLog(@"%d The size of unsigned short is: %d.",  i++, sizeof(unsigned short));
	NSLog(@"%d The size of unsigned int is: %d.",  i++, sizeof(unsigned int));
	NSLog(@"%d The size of unsigned long is: %d.",  i++, sizeof(unsigned long));
	NSLog(@"%d The size of unsigned long long is: %d.",  i++, sizeof(unsigned long long));
	NSLog(@"%d The size of a float is: %d.",  i++, sizeof(float));
	NSLog(@"%d The size of a double is %d.",  i++, sizeof(double));
	return 0;

Thread Closed

« About the parser for dashboard | Cocoa/Xcode/changing template »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting 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 Off
Forum Jump

Similar Threads
Thread Starter
Last Post
About file types Xi0N OS X - Apps and Games 1 04-16-2009 06:18 PM
Apple Powerbook G4 types in wrong characters mirrorkiss OS X - Operating System 6 02-23-2009 04:08 PM
new to iChat : confusion over account types LikeInTheMovies OS X - Apps and Games 3 12-28-2008 02:41 PM
question about objective C memory allocation thuffir OS X - Development and Darwin 3 11-18-2008 10:30 PM
Any system administrator types out there?? baal Switcher Hangout 5 03-07-2004 04:26 PM

All times are GMT -4. The time now is 06:35 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?