polarisxu icon indicating copy to clipboard operation
polarisxu copied to clipboard

posts/go/action/operator/

Open utterances-bot opened this issue 11 months ago • 1 comments

我无语了,Go 中 +-*/ 四个运算符竟然可以连着用

https://polarisxu.studygolang.com/posts/go/action/operator/

utterances-bot avatar Mar 05 '24 07:03 utterances-bot

也就是说,+-*v 相当于:0+(0-(*v))。(为什么一元运算符左结合,因为一元,必须得有运算数,得跟着运算数走)

这里说的不对吧?一元运算符应该是右结合,+-*v 变成 0+(0-(*v)) 不是右结合么?

potoo0 avatar Mar 05 '24 07:03 potoo0