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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:58:02+00:00 2026-06-06T22:58:02+00:00

I read this question in stackoverflow. The excerpt answer provided by bbum is below:

  • 0

I read this question in stackoverflow.

The excerpt answer provided by bbum is below:

The problem isn’t the assignment, it is much more likely that you
declared your instance variable to be BOOL *initialBroadcast;.

There is no reason to declare the instance variable to be a pointer
(at least not unless you really do need a C array of BOOLs).. Remove
the * from the declaration.

1.Is there anything wrong in using a pointer variable even when I do not have to maintain an array of BOOLs?

2.I think even if avoiding them a good practice, it is not specific to objective-C and applies to all programming languages which has pointers.

Please answer my questions.

  • 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-06T22:58:04+00:00Added an answer on June 6, 2026 at 10:58 pm

    1.Is there anything wrong in using a pointer variable even when I do not have to maintain an array of BOOLs?

    It’s not illegal to do so, but it is bad practice. Using a pointer variable requires that you manage that memory (allocate and free it), and there are whole classes of bugs that can occur as a result. If you forget to allocate the memory, or accidentally modify the pointer, your program could crash, or you could overwrite some other part of memory. If you forget to free the memory, you have a memory leak. None of these things can ever happen if you’re just using a plain BOOL. In addition, you get no benefit from using a pointer here; you do a bunch of extra work, and get nothing in return.

    2.I think even if avoiding them a good practice, it is not specific to objective-C and applies to all programming languages which has
    pointers.

    I don’t know about “all programming languages which [have] pointers”, but I would certainly say in any C-based language (C, C++, Objective-C), it’s bad practice to use pointers to intrinsic types when a plain variable of that type will do. If you can avoid doing memory management, do so.

    On a side note, it is good practice to listen to everything bbum says. Seriously.

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

Sidebar

Related Questions

My question is in relation this this answer. https://stackoverflow.com/a/8773953/1297775 I have read at many
I read all topics related to this question in stackoverflow and whole internet and
Read about the issue in this stackoverflow question . Still have the same issue
I read this question but the answer does not perform a refactoring of the
I have read this question and the simple and clear answer but it's not
I posted this digital logic diagram as an answer to another stackoverflow question .
This question relates to https://stackoverflow.com/questions/9603/what-is-some-great-source-code-to-read which compiles a list of great (in the sense
This question is an continuation on another StackOverflow post where no clear answer is
My system was mentioned in this question: https://stackoverflow.com/questions/5633634/best-index-strategies-for-read-only-table because the data is readonly, and
I've read this: https://stackoverflow.com/questions/631850/how-do-you-name-your-many-to-many-relationship-tables But my question is a little different. I'm just wondering

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.