secondwtq
2020-06-29 19:03:45 +08:00
随手看了一下 spec,你这个事 constant expression,有这么一段:
> Any other operation on untyped constants results in an untyped constant of the same kind; that is, a boolean, integer, floating-point, complex, or string constant. If the untyped operands of a binary operation (other than a shift) are of different kinds, the result is of the operand's kind that appears later in this list: integer, rune, floating-point, complex. For example, an untyped integer constant divided by an untyped complex constant yields an untyped complex constant.
大概是为了 大道至简 把 C 里面的类型提升给整过来了。