golang官方的FAQ,包含了初学者常见的一些问题和解答。整理下翻译和自己的见解。

https://golang.org/doc/faq#change_from_c

Why are ++ and -- statements and not expressions? And why postfix, not prefix?

Without pointer arithmetic, the convenience value of pre- and postfix increment operators drops. By removing them from the expression hierarchy altogether, expression syntax is simplified and the messy issues around order of evaluation of ++ and -- (consider f(i++) and p[i] = q[++i]) are eliminated as well. The simplification is significant. As for postfix vs. prefix, either would work fine but the postfix version is more traditional; insistence on prefix arose with the STL, a library for a language whose name contains, ironically, a postfix increment.

由于没有指针运算,和简化表达式语法,x++等不再是表达式(expression),而是语句(statement)

  • expression: 表达式 就是加减乘除等各种运算符号联接起来的式子a ? b : c 这是?和:组成的操作符号,自然也是表达式;
  • statement 语句:每种语言的语句就那么几种:for, while , if else, do..while , switch