PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Objective-C

Objective-C

Objective-C is a pl created in 1984 by Brad Cox.

#42on PLDB 38Years Old 12.4kUsers
15Books 0Papers 536kRepos

Try now: Riju

Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. It was the main programming language used by Apple for the OS X and iOS operating systems, and their respective application programming interfaces (APIs) Cocoa and Cocoa Touch prior to the introduction of Swift. The programming language Objective-C was originally developed in the early 1980s. Read more on Wikipedia...


Example from Riju:
#import <Foundation/Foundation.h> int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@"Hello, world!"); [pool drain]; return 0; }
Example from hello-world:
/* Build on OS X: clang -framework Foundation -fobjc-arc objc.m -o objc Build on Linux with GNUstep: clang `gnustep-config --objc-flags` `gnustep-config --base-libs` -fobjc-nonfragile-abi -fobjc-arc objc.m -o objc */ #import <Foundation/Foundation.h> int main(void) { NSLog(@"Hello World"); }
Example from the Hello World Collection:
/* Hello World in Objective-C. ** Since the standard implementation is identical to K&R C, ** a version that says hello to a set of people passed on ** the command line is shown here. */ #include <stdio.h> #include <objpak.h> int main(int argc,char **argv) { id set = [Set new]; argv++;while (--argc) [set add:[String str:*argv++]]; [set do:{ :each | printf("hello, %s!\n",[each str]); }]; return 0; }
Example from Linguist:
#import "Foo.h" @implementation Foo @end
Example from Wikipedia:
-(void) firstLabel: (int)param1 secondLabel: (int)param2;

Keywords in Objective-C

auto break case char const continue default do double else enum extern float for goto if inline int long register restrict return short signed sizeof static struct switch typedef union unsigned void volatile while _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil NO NULL oneway out Protocol SEL self Super YES @ @interface @end @implementation @protocol @class @public @protected @private @property @try @throw @catch() @finally @synthesize @dynamic @selector atomic nonatomic retain

Language features

Feature Supported Example Token
Conditionals
Switch Statements
Constants
While Loops
MultiLine Comments
/* A comment
*/
/* */
Print() Debugging printf
Comments
// A comment
Message Passing
Line Comments
// A comment
//
Interfaces
@protocol Printing
   -(void) print;
@end
File Imports
// #import ensures that a file is only ever included once so that you never have a problem with recursive includes.
#import 
#include 
#include 
Constructors
Pointers
Single Dispatch
Strings
"hello world"
"
Semantic Indentation ϴ
Operator Overloading ϴ
Garbage Collection ϴ

Books about Objective-C on goodreads

title author year reviews ratings rating
Programming in Objective C Stephen G. Kochan 1999 21 445 3.96
Programming in Objective-C 2.0 Stephen G. Kochan 2008 16 370 3.85
Objective-C Programming: The Big Nerd Ranch Guide Aaron Hillegass 2011 41 634 4.17
The Objective-C Programming Language Apple Inc. 0 24 3.62

Books about Objective-C from ISBNdb

title authors year publisher
Programming in Objective-C (Developer's Library) Kochan, Stephen G. 2012 Addison-Wesley Professional
Learn Objective-C on the Mac (Learn Series) Knaster, Scott and Dalrymple, Mark 2008 Apress
Objective-C DeVoe, Jiva 2011 Wiley
Learn Objective-C on the Mac: For OS X and iOS Knaster, Scott and Dalrymple, Mark and Malik, Waqar 2012 Apress
Objective-C for Absolute Beginners: iPhone, iPad and Mac Programming Made Easy Bennett, Gary and Fisher, Mitchell and Lees, Brad 2011 Apress
Head First iPhone and iPad Development: A Learner's Guide to Creating Objective-C Applications for the iPhone and iPad Pilone, Dan and Pilone, Tracey 2011 O'Reilly Media
Learn Objective-C for Java Developers (Learn Series) Bucanek, James 2009 Apress
Objective-C for iPhone Developers, A Beginner's Guide Brannan, James 2010 McGraw-Hill Education
Learning the iOS 4 SDK for JavaScript Programmers: Create Native Apps with Objective-C and Xcode Goodman, Danny 2011 O'Reilly Media
Pro Objective-C Design Patterns for iOS Chung, Carlo 2011 Apress
Objective-C Fundamentals Fairbairn, Christopher and Ruffenach, Collin and Fahrenkrug, Johannes 2011 Manning Publications
visual-basic.html · objective-c.html · julia.html

View source

PLDB - Build the next great programming language · v2022 · Day 28 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com