The operator ^ for exponentiation or for excluding: how not to confuse them?

7 months ago by CodyIT to c/golang

In some languages, the ′^′ operator can be used for exponentiation, but in other popular development stacks, it operates as the exclusive OR (XOR) operator. Today, we′ll discuss how this confusion...

Gophers, hey. Confusing ^ with exponentiation instead of XOR in Go seems like a pretty easy mistake to make. The bug itself is simple, but it still shows up even in some well-known projects with large codebases.

How often does this happen in your code?

I_quote_Seinfeld_a_lot 2 points 7 months ago

Is this just a desperate AI ad with a cheap call to action to increase engagement?

path: 0 22527719, hotness: undefined, score: 2, children: 0
Multiplexer 1 point 7 months ago
path: 0 22509701, hotness: undefined, score: 1, children: 0
golang
golang

@programming.dev

login for more options
2783
316
22

This is a community dedicated to the go programming language.

Useful Links:

Rules:

  • Posts must be relevant to Go
  • No NSFW content
  • No hate speech, bigotry, etc
  • Try to keep discussions on topic
  • No spam of tools/companies/advertisements
  • It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

go to feed...