Is it allowed to name the parameter in postfix operator ++?

后端 未结 3 602
借酒劲吻你
借酒劲吻你 2021-01-01 11:39

I am not using this code in any production environment, it is just for my understanding. Is this code valid (i.e. can I define my postfix operator like this?):



        
3条回答
  •  有刺的猬
    2021-01-01 12:25

    Yes, it is valid the int as a parameter it only a policy enforcing parameter to distinguish between prefix and postfix operators. The passed parameter will be received as an argument, which is the behavior you see & it is prfectly defined behavior.

提交回复
热议问题