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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:05:24+00:00 2026-05-28T05:05:24+00:00

The compiler seems to have no problem with the two following declarations: NSObject *

  • 0

The compiler seems to have no problem with the two following declarations:

NSObject * __weak weakThing;
__weak NSObject *anotherWeakThing;

Is there a difference between the two? Is the behavior like the const keyword?

I ask because Xcode’s warning generally suggest …

SomeDataType * __weak / __strong

… when you’ve goofed something up. So I’ve tried to follow this pattern, but wondered if there was a difference at all.

  • 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-28T05:05:25+00:00Added an answer on May 28, 2026 at 5:05 am

    No, there is no difference. With the const keyword, there are multiple things it could apply to in a declaration; it could apply to the pointer, or it could apply to the value being pointed to.

    Ownership qualifiers only make sense on pointers to objects. The object itself can’t be “strong” or “weak”; it’s the pointer to the object that is strong or weak. ARC only makes sense when applied directly to pointer-to-object types, and affects how that pointer’s lifetime will affect the lifetime of the object.

    Given that there is never any ambiguity about what the ownership qualifier could apply to, the ARC specification allows placement of the ownership qualifier anywhere in the definition of the pointer-to-object. Both of your examples are equally valid. Likewise, all of the following mean the same thing:

    NSError * __autoreleasing * someObject;
    NSError __autoreleasing ** someObject;
    __autoreleasing NSError ** someObject;
    

    Note that the compiler complains about this one, though:

    NSError ** __autoreleasing someObject;
    

    This is because you’ve moved beyond the definition of the pointer-to-object. You could parse that one as (NSError *)* __autoreleasing someObject;. By the time you get to the second *, you’ve already defined the type of the pointer, so __autoreleasing doesn’t make any sense. Anywhere within the definition of the pointer type is fine, but once you move onto the pointer-to-pointer type, then you’re referring to something else, and it no longer makes sense.

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

Sidebar

Related Questions

I have the following problem, which seems not to have a nice solution. For
I have got a problem when I try to make following simple connections QSpinBox
This seems like it should be a simple question. I have two QSpinBoxes in
I have a problem which I think is related to forward declarations, but perhaps
Nant seems very compiler-centric - which is guess is because it's considered a .NET
Anyone know this compiler feature? It seems GCC support that. How does it work?
Relying on the preprocessor and predefined compiler macros for achieving portability seems hard to
Intuitively, it would seems that a compiler for language Foo cannot itself be written
I have two tables Orders(ID,ORDERDATE,DELIVERYDATE,GOODID,QUANTITY,COLLECTIONFROM,DELIVERYTO,NOTES) and ROLLINGSTOCK_ORDER(ORDERID,ROLLINGSTOCKID,DEPARTUREDATE,DELIVERYDATE,ROUTEID) i have created a trigger to update
There are two vb6 applications that I work with. One of them starts up

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.