BTSJimin's blog

By BTSJimin, history, 11 hours ago, In English

Sometimes, I use too much '(',')' because of this anxiety:

if( ( ((a+5)/2)  + (c*2))  == ((((b^1)&1) * 2) + 3) ){
    blabla;
}

How to solve this issue?

  • Vote: I like it
  • +26
  • Vote: I do not like it

»
11 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

lmao same (╥﹏╥)

»
11 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Me too lol

»
11 hours ago, # |
  Vote: I like it +4 Vote: I do not like it

I just use them with bitwise operations

»
11 hours ago, # |
  Vote: I like it +33 Vote: I do not like it

You needn't (and, shouldn't) solve this issue.

You needn't to spend a lot of time debugging on a few brackets.

»
9 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

can someone explain it for me?

»
8 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

same. Also this happens in math when im writing equations lol.

»
6 hours ago, # |
  Vote: I like it +10 Vote: I do not like it

If you are on Linux, use man operator for your quick reference (online manual of operator(7)).

Generally, I think it's fine to use parentheses for bitwise and logical operators. Precedence of arithmetic operators is easy to remember.

»
3 hours ago, # |
  Vote: I like it +6 Vote: I do not like it

I try to put intermediate values into temporary variables. It also makes things faster when I get WA and need to debug

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

use ChatGPT it's straight forward