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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:28:54+00:00 2026-05-25T01:28:54+00:00

A philosophical question, of sorts. Is it proper to assign a constant string to

  • 0

A philosophical question, of sorts. Is it proper to assign a constant string to an @property that’s (retained)? Or, should I do self.string = [NSString stringWithString:@""];

Is there a memory leak? What if it’s overreleased?

It’s a constant string, so does it behave the same way as an NSString object?

If the property is (assign) does that mean it will not be valid after the run loop?

  • 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-25T01:28:55+00:00Added an answer on May 25, 2026 at 1:28 am

    Yes, it’s fine. No matter which way you do it, the constant string will still be compiled into your program (because you have to use it in [NSString stringWithString:@""] anyway). Constant strings don’t actually get retained/released, but the what matters is the semantics of it: you’re assigning a string (which has a net +0 retainCount as far as you’re concerned — you haven’t alloced it, so you don’t own it) to a property which will take ownership of it. If the property is (assign), then it may still work with a constant string, but it will be semantically invalid after the autorelease pool drains.

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

Sidebar

Related Questions

Philosophical question: Say I've got a web app that requires javascript and a modern
This might be more of a philosophical question, but is there a compelling reason
I have a little bit philosophical question. There is a class A class A
Bit of a philosophical question. If you have a public website with a site
This is more of a philosophical question than anything, so give me your thoughts.
This one is almost a philosophical question: is it bad to access and/or set
This question is more philosophical than technical. I've trained myself as a web developer
My question, is not a philosophical one, but one of methodology. I understand how
Context I apologize for this question being soft / philosophical; it's a set of
I have an encryption/copy protection question. I'm writing an application for a company that

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.