Kết quả tìm kiếm

  1. P

    Why does C++ disallow the creation of valid pointers from a valid address and type?

    Thanks, it is clear now. Here's the exact sentence in the standard stating that this is UB: eel.is/c++draft/basic.compound#3.sentence-10
  2. P

    Why does C++ disallow the creation of valid pointers from a valid address and type?

    If you know two pieces of information: A memory address. The type of the object stored in that address. Then you logically have all you need to reference that object: #include <iostream> using namespace std; int main() { int x = 1, y = 2; int* p = (&x) + 1; if ((long)&y ==...
Top