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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:31:39+00:00 2026-06-06T11:31:39+00:00

I am working on project where I have the checkInternet method in one of

  • 0

I am working on project where I have the checkInternet method in one of my class for verifying internet availability. In that method I have following code:

For below code of line I am getting warning that, “Using Logical && with constant operand”
for this code of block (flag && kSCNetworkFlagsReachable).

BOOL isavailable = NO;
Boolean success;
isavailable = success && (flag && kSCNetworkFlagsReachable) && !(flag & kSCNetworkFlagsConnectionRequired);

and as a solution xcode giving option that “Use & for bitwise operand” that’s fine I do it like that and it removed my warning.
But I want know how it was working logical operators? and Why it’s telling me to change to for bitwise?

  • 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-06T11:31:41+00:00Added an answer on June 6, 2026 at 11:31 am

    The bitwise operator & compares each individual pair of bits. The result will be non-null only if the left and right operands have at least one matching bit set to 1.

    Example : 0100 AND 0010 → 0000 but 0110 AND 0010 → 0010.

    This operator allows you to use a single integer value to store several booleans on different bits, then use a second value (known as a mask) to filter the bits.

    kSCNetworkFlagsReachable is equal to 1<<1 (2). Thus, flag & kSCNetworkFlagsReachable is true only if the second least significant bit of flag is set to 1.

    Using && instead of & is a common mistake. The compiler will try to detect that mistake. In your example, kSCNetworkFlagsReachable is a constant value. As kSCNetworkFlagsReachable is constant and always true, testing whether flag && kSCNetworkFlagsReachable is true is the same as testing whether flag is true. Thus it is very unlikely that you really wanted to use a constant value in a logical operation. That’s why the compiler emits the warning.

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

Sidebar

Related Questions

I'm working on a project and have written code that determines how much money
I have a problem that I'm working in nHibernate project that have the following
I'm working on a project that have the following need: use source ip address
I am working on a project and have the following psuedocode: // create a
I have a fully working Setup project within Visual Studio 2008 that takes inputs
I am working on a project. This project have a user interface that we
i'm having an weird problem, my project have a login page, that's working, but
Hi i'm working on project that have a table view with 10 controllers every
i have one project working greate but in other iphone not working .both are
I have been working in a project that have been working wothount problems till

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.