BTSJimin's blog

By BTSJimin, history, 14 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
  • +31
  • Vote: I do not like it

»
14 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

lmao same (╥﹏╥)

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

Me too lol

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

I just use them with bitwise operations

»
14 hours ago, # |
  Vote: I like it +35 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.

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

can someone explain it for me?

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

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

»
8 hours ago, # |
  Vote: I like it +21 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.

»
5 hours ago, # |
  Vote: I like it +7 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

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

use ChatGPT it's straight forward