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

  • Home
  • SEARCH
  • 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 6022329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:50:33+00:00 2026-05-23T03:50:33+00:00

How would I dealloc a boolean value? Deallocing it this way below gives me

  • 0

How would I dealloc a boolean value?

Deallocing it this way below gives me a warning: Incompatible pointer to integer conversion assigning to ‘BOOL’ (aka ‘signed char’) from ‘void *’

- (void)dealloc {
    self.booleanVar = nil;
    [super dealloc];
}

Perhaps I should clarify, this is from a simple class inherited from NSObject.

I’m using the self.var = nil pattern that you see in Cocoa Touch classes. Let’s say if it was an NSString* instead should I use self.var = nil or [var release] in the deallocmethod? I’m a little confused here.

  • 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-23T03:50:34+00:00Added an answer on May 23, 2026 at 3:50 am

    You don’t need to do it. It is not an object. This also explains the warning, as you’re trying to assign a nil pointer (that’s a NULL for objects basically) to a non-object.


    Regarding your second question, yes. You can think of primitive variables as being part of the object, so when it’s deallocated the vars will not exist anymore.

    But when you have a NSString * in an object, it’s just a pointer to another object. If you dealloc the former, the pointer will be deleted, not the NSString. No one might point to it, it’s kind of lost in the air, occupying memory. So, before deleting the pointer, if you won’t need the object anymore, you send it a release message. That’s done in the dealloc method, since it’s called to “delete” and object and thus is a good place to delete also every other object that has no use anymore.

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

Sidebar

Related Questions

In the dealloc method for a class how would I print out the ID
I would like to accomplish something like what is being done in this post:
I was wondering why this code would give me black UITableViewCells when I set
I am looking at an example online that contains this code in objective-c -(void)dealloc
I thought this would be something that's fairly common - but cant find it
I've been staring at this same issue for a long time now, and would
Would it not make sense to support a set of languages (Java, Python, Ruby,
Would it be possible to print Hello twice using single condition ? if condition
Would it be possible to show an image in full screen mode using silverlight.
Would the following SQL remove also the index - or does it have to

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.