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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:21:16+00:00 2026-06-12T19:21:16+00:00

What are intuitive reasons for >= and ‘>’ to be higher precedence than |

  • 0

What are intuitive reasons for >= and ‘>’ to be higher precedence than |? Reference.
I could understand why || is lower as writing a>b||c is common. However I’d think a>b|c would be doing an OR before the compare. This doesn’t seem intuitive. What are examples of &^| being lower precedence then compare/equity operators being intuitive?

  • 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-12T19:21:19+00:00Added an answer on June 12, 2026 at 7:21 pm

    It’s a historical accident, in The Development of the C Language, Dennis Ritchie wrote:

    Their tardy introduction explains an infelicity of C’s precedence rules. In B one writes

        if (a==b & c) ...
    

    to check whether a equals b and c is non-zero; in such a conditional expression it is better that & have lower precedence than ==. In converting from B to C, one wants to replace & by && in such a statement; to make the conversion less painful, we decided to keep the precedence of the & operator the same relative to ==, and merely split the precedence of && slightly from &. Today, it seems that it would have been preferable to move the relative precedences of & and ==, and thereby simplify a common C idiom: to test a masked value against another value, one must write

        if ((a&mask) == b) ...
    

    where the inner parentheses are required but easily forgotten.

    So it’s because B used | and & for the logical operators, and C kept the precedence for the thus-denoted bitwise operators.

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

Sidebar

Related Questions

I am writing code that catches this OutOfMemoryException and throws a new, more intuitive
First off, I understand the reasons why an interface or abstract class (in the
Why is it counter intuitive? /(?<!\d)\d{8}(?!\d)/ , here (?<!\d) comes first , but called
Most of Knockout seems very intuitive. One thing that is strange to me though
I've always found SQL Server date formatting to be counter intuitive. I am pretty
ActiveRecord's query interface seems for me sometimes very complex and not intuitive. Is there
I'm looking for a well-maintained Java bytecode manipulation library with an intuitive API. There
My problem seems to be quite simple, but it's not working the intuitive way.
I'm torn between two worlds, I have this very intuitive (but intricate) mechanism in
I was wondering, how would you go about writing an application that basically houses

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.