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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:43:48+00:00 2026-06-17T14:43:48+00:00

In objective-c, I know that a static variable (should?) retain its value for the

  • 0

In objective-c, I know that a static variable (should?) retain its value for the lifetime of the program. But if it stores a pointer, does it count as strong in ARC? Can I depend on it and be assured that that instance will never go out of the heap once I assigned it to a static variable?

static ClassA* shared;

-(id)init
{
   if (self=[super init]) {
       shared=self;
   }
   return self;
}
  • 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-17T14:43:49+00:00Added an answer on June 17, 2026 at 2:43 pm

    Yes you can rely on it, once it’s assigned.

    The Transitioning to ARC Release Notes state:

    Under ARC, strong is the default for object types.

    and then:

    __strong is the default. An object remains “alive” as long as there is a strong pointer to it.

    Given your static pointer references the object, it will remain “alive”. The scope of a pointer (whether global, a pointer on the stack or an instance variable) makes no difference.

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

Sidebar

Related Questions

Does anyone know of a library for RDP that's written in C or Objective-C
I know that the @property generates the getters and setters in Objective-c. But I've
I'm trying to sort a multidimensional array in objective-c i know that i can
hello I have a small question in objective-C memory management. I know that if
I am new to iOS and Objective-C, I already know that in a class,
I wanted to know , How exactly does an Objective C object gets created.
I have an Objective C static library that I am trying to import into
I have an monotouch application that includes an objective-c static library. The application runs
Basically, I know that Label works for the basic string. But what I want
Is there anything like C++s safe casts in Objective-C? I know that they are

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.