Comment

Comment by aw1621107

> and is no longer undefined behaviour to act on them

This is only partially true. From the proposal [0]:

> Moreover, a variable that has a well-defined, erroneous initial object representation under this proposal can still lead to undefined behaviour later on:

    void f(T&);
    void g(bool);

    void h() {
      T* p;    // uninitialized, has erroneous value (e.g. null)
      bool b;  // uninitialized, erroneous value may not be valid bool

      f(*p);   // dereferencing has undefined behaviour
      g(b);    // undefined behaviour if b is invalid
    }
[0]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p27...
parent aw1621107 15 days ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton