Are pointers to allocated memory outside object's lifetime “invalid pointer[s]” or “pointer[s] to an object”?

后端 未结 2 1814
执念已碎
执念已碎 2020-12-11 07:01

C++17 (draft N4659) [basic.compound]/3 says:

Every value of pointer type is one of the following:

  • a pointer to an object or fu

2条回答
  •  一向
    一向 (楼主)
    2020-12-11 07:07

    All C++ standard are an abject mess when it comes to basic runtime concept.

    What is an lvalue? It needs to be able to refer to a not yet created object. (Same for pointers.)

    When do not created object exist? Do they appear just before they are needed?

    To me the best approach would have been to assume all object types exist everywhere in memory where they fit. Many people here told me that was insane and contradictory yet no one ever pointed to a contradiction.

提交回复
热议问题