Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6072189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:07:57+00:00 2026-05-23T10:07:57+00:00

I was just looking through my code and wondering about the standards of obj.c

  • 0

I was just looking through my code and wondering about the standards of obj.c in xcode. We have all these NS(insert object type) which overlap with the original C, C++ objects. I wanted to clarify between different alternatives of snippets of code. Even better than explaining each one would be a link to a guide or reference containing all these.

object.property = blah; or [object setProperty:blah];
float aFloat = 0.01;(or double) or CGFloat aFloat = 0.01
int anInt = 1 or NSInteger anInt = 1
@"%d", anInt or @"%i", anInt

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:07:57+00:00Added an answer on May 23, 2026 at 10:07 am

    The first one (dot notation vs method calls) is purely a thing of taste. man printf says that %d and %i both are placeholders for signed decimal, hence ObjC being strict superset of C doesn’t change their meaning.

    Types with NS or CG prefixes are platform dependent and are actually typedef‘ed from standard C types. If you decide to compile for different platforms (say 32/64 bit) using NS/CG types will fall back to default types of the platform you’re compiling for. Take for example NSInteger (snippet from NSObjCRuntime.h):

    #if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
    typedef long NSInteger;
    typedef unsigned long NSUInteger;
    #else
    typedef int NSInteger;
    typedef unsigned int NSUInteger;
    #endif
    

    It shows that if you’re not compiling for iOS, the NSInteger will stand for long, otherwise – it will be simple int.

    Personal opinion

    I always use %d since I saw it first in some ObjC tutoria. Never looked back on other placeholders for integers (unless %lld). I use the dot notation only if receiver type is known at compile time. Sometimes you may have to write this:

    id possiblyView = [someObject someView];
    // the following line will give compile warning
    possiblyView.frame
    // the following line won't
    [possiblyView frame];
    

    The result of those calls is the same, but the first line forces compiler look for frame variable under id-typed structure.

    And I always try to use the NS/CG variable types since they make code look more ObjC-ish than C-ish.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was looking through a code tutorial just now, and found something interesting --
I was just looking through some information about Google's protocol buffers data interchange format.
I'm looking at this code and have been through the docs but still don't
Just looking through the LINQ tutorials on MSDN and come accross the following code:
Ive just started year three of my computing degree and have been looking through
I was just looking through the man page for printf and something occurred to
I'm looking for a way to search through our subversion repository or just packaged
User System and Passwords: I was looking through MD5 stuff, and I am wondering
I was looking through some code and i saw this: <xsl:variable name=newlist select=concat(normalize-space($list), '
I'm about to start working on a new project and am wondering if Code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.