Why does C have a distinction between -> and .?

前端 未结 7 1696
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-28 09:56

OK, this is of no serious consequence, but it\'s been bugging me for a while: Is there a reason for the distinction between the -> and . operato

7条回答
  •  醉酒成梦
    2020-11-28 10:12

    A distinguishing feature of the C programming language (as opposed to its relative C++) is that the cost model is very explicit. The dot is distinguished from the arrow because the arrow requires an additional memory reference, and C is very careful to make the number of memory references evident from the source code.

提交回复
热议问题