History of trailing comma in programming language grammars

后端 未结 4 1511
执念已碎
执念已碎 2020-11-30 10:16

Many programming languages allow trailing commas in their grammar following the last item in a list. Supposedly this was done to simplify automatic code generation, which is

4条回答
  •  庸人自扰
    2020-11-30 10:30

    Something which has always galled me about C is that although it allows an extra trailing comma in an intializer list, it does not allow an extra trailing comma in an enumerator list (for defining the literals of an enumeration type). This little inconsistency has bitten me in the ass more times than I care to admit. And for no reason!

提交回复
热议问题