What's a modern term for “array/pointer equivalence”?

后端 未结 11 1255
孤城傲影
孤城傲影 2020-12-14 06:12

Just about everyone reading this is probably familiar with these three key facts about C:

  1. When you mention the name of an array in an expression, it evaluates
11条回答
  •  北海茫月
    2020-12-14 06:43

    I suggest "array-to-pointer decay" is a reasonable shorthand, since "decay" is commonplace jargon in referring to the type conversion, with precedent elsewhere in the C FAQ: Question 6.12:

    Q: Since array references decay into pointers, if arr is an array, what's the difference between arr and &arr?

    An extended technical meaning of "decay" that includes this one has been adopted into C++ Standard Library nomenclature since C++11: std::decay

提交回复
热议问题