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 8857179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:31:46+00:00 2026-06-14T14:31:46+00:00

Ok, I am confused! I used to use -> whenever I accessed my instance

  • 0

Ok, I am confused!
I used to use -> whenever I accessed my instance objects, but now I see that after I set them in my application:didFinishLaunching like this:

self->counter = [NSNumber numberWithFloat:0.0f];

Down the road I got thrown out with an Exception, checked my debugger and saw that counter was pointing to a <non objective c object>

I changed the line to :

self.counter = [NSNumber numberWithFloat:0.0f];

And now I see in the debugger that I have yes another variable.

So, what is happening here?

  • 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-14T14:31:47+00:00Added an answer on June 14, 2026 at 2:31 pm

    self->counter = [NSNumber numberWithFloat:0.0f]; uses direct access to an ivar. With self, it is equal to counter = [NSNumber numberWithFloat:0.0f]; where counter is an ivar. That is to say self-> is a redundant scope qualification within an instance method.

    self.counter = [NSNumber numberWithFloat:0.0f]; is syntactic sugar for [self setCounter:[NSNumber numberWithFloat:0.0f]];. Specifically, the declaration dynamically messages the object’s setter for counter. Although there are exceptions, you should favor using the accessor when not in a partially constructed/destructed state.

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

Sidebar

Related Questions

I'm a bit confused now. I thought that when you used extern on a
this is the code i used in my application but i am confused with
After thinking that I finally figured git out, I'm now finding myself super-confused about
I'm just confused about what's the padding mode used when use crypto:des_ecb_encrypt/2 in erlang.
I'm confused on how to use pointer notation to access a struct used with
I was confused when I first started to see anti-singleton commentary. I have used
I'm a bit confused by the logic that's been used to arrive at the
I've just read Ada Programming but I'm a bit confused about how to use
I want to use JsTestDriver to drive my QUnit tests, but I'm confused about
I'm a little confused about the naming conventions used here... but AFAIK it is

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.