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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:04:02+00:00 2026-06-04T07:04:02+00:00

I have a unique situation with setStringValue: and hoping someone could clear this up:

  • 0

I have a unique situation with setStringValue: and hoping someone could clear this up:

Using the following theoretical example (not literal) code:

NSString *myVar;

[myOutlet setStringValue:myVar];

It appears that for any string value such as:

myVar = @"hello";

a pointer is passed to myOutlet and the NSTextField points to the same memory location as myVar, essentially making them identical. In essence:

myVar == [myOutlet stringValue];

returns TRUE.

HOWEVER

in this situation:

myVar = @"";

it seems as if it is not passing a pointer, but rather NSTextField is creating it’s own independent memory location to store it’s empty string, essentially:

myVar == [myOutlet stringValue];

return FALSE.

Can anyone confirm whether this is true, and if so, explain why? I believe this to be the source of a very complex problem I’m having in a piece of code I’m working on and I’m trying to wrap my mind around the root of the problem.

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-06-04T07:04:03+00:00Added an answer on June 4, 2026 at 7:04 am

    Basically, it’s pure chance that the first situation works out. These pointers are absolutely not guaranteed to be equal, and if you need to compare strings, use -isEqualToString: always.

    What you’re running into is probably an optimization of some sort, to avoid storing @"hello" more than once. We have no way of knowing when this will or will not happen, and it may change in the future, or from device to device.

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

Sidebar

Related Questions

I have an interesting situation, well it's probably not that unique at all, but
I have a fairly unique situation, I have never needed to this before anyways.
I have what I hope is not a unique situation... ...and I'm looking for
I have a unique situation where I'm building a site that will call data
I have a unique situation over here. I have a button on a form
I have a sort of unique situation....I want to populate a ModelChoiceField based of
Greetings! Situation: We have a CRM system that generates unique customer IDs. Now we
I have a unique industrial application where I do not want the Windows CE
I Want to have only unique values in a SharePoin List. To achieve this
I have a situation where I need to store a globally unique identifier 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.