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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:56:57+00:00 2026-06-01T04:56:57+00:00

There is some code that I am using written by someone else that I

  • 0

There is some code that I am using written by someone else that I have a question….

NSString *c = @"test";  // "Local" string
NSString *d = [NSString alloc]initWithString:@"test"]; // "Heap" string

const char *c = "test";
return [NSString stringWithUTF8String:c]; // ??

I am not sure what the return statement in this case is returning. I would have written it something like…

return [NSString alloc]initWithUTF8String:c];

or

return [NSString alloc]initWithUTF8String:c]autorelease];

Why would the return statement be written like above?

  • 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-01T04:56:58+00:00Added an answer on June 1, 2026 at 4:56 am

    [NSString stringWithUTF8String:c] returns an autoreleased object ..so its the same thing as [NSString alloc]initWithUTF8String:c]autorelease] but from what i understand from documentation [NSString stringWithUTF8String:c] doesn’t make a copy of the string..so its faster

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

Sidebar

Related Questions

I have some PHP code (written by someone else) that's parsing a html file
I recently inherited some code that someone else had written. I discovered that everywhere
I'm using .net. Is there some code somewhere that can change $11,456.50 -> eleven
I have some code that looks like this. There is also an autoincrement field
I have some code that creates a Process instance and later starts it. There's
I've got some (badly written) legacy code that I have to modify but I'm
I have written some code which checks a site for broken links using the
There is some code that I'm trying to convert from IList to IEnumerable :
I'm writing some code that has a lot of substitution. There's a list<char> productions
I'm working on some code that deals with parsing files (mainly XML, but there

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.