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

  • SEARCH
  • Home
  • 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 7798583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:03:09+00:00 2026-06-02T00:03:09+00:00

What is the difference between following code fragments? No. 1 @interface HistoryJsonBean : NSObject

  • 0

What is the difference between following code fragments?

No. 1

@interface HistoryJsonBean : NSObject
{
}

@property (nonatomic,retain) NSString * unit;

No. 2

@interface HistoryJsonBean : NSObject
{
    NSString * unit;
}

@property (nonatomic,retain) NSString * unit;

I am a newbie, is there really a difference between above two codes?

  • 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-06-02T00:03:10+00:00Added an answer on June 2, 2026 at 12:03 am

    The first syntax is relying on a feature of modern Objective C runtime systems to create the corresponding variable from a property definition. So, the second syntax is just Objective C 2.0 syntax used with older runtime systems.

    Have also a look at this post from S.O.

    EDIT:

    The variable in the latter case is an ivar.

    The property definition was originally just a short-way to define accessor methods for its ivar (with the proper memory management). Newer runtime systems relax the need to declare the ivar, and you can go by with just the property definition (which will also imply the allocation of memory to store the value associated to the property).

    From the interface point of view, on a new runtime system there is no difference between the two syntaxes you mentioned. Now, if the runtime system handles them is two different ways, this could only be said by inspecting the implementation in the runtime systems source code. My guess is that there is no difference at that level either.

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

Sidebar

Related Questions

Is there any practical difference between the following two code snippets: NSObject * obj
I have been told that there is a performance difference between the following code
Is there a difference between having the following code at the begining of program
Is there any difference between the following pieces of code in terms of processor
there is a difference between how the following code runs on sql2008 and sql2000.
The following code does the exact same thing. Is there a difference between for
is there some significant difference between PHP 5.4 and 5.2.13 for the following code?
What is the difference between the following code? CREATE TYPE f1_MemberType AS OBJECT (
Using LINQ on collections, what is the difference between the following lines of code?
What is the difference between the following two snippets of code: using (Object o

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.