Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From the proposal, I see a bunch of new keywords and rules - alright given the language's heritage. But what happens if I "relocate" a variable value - would a "shell" remain or how exactly C++ is supposed to handle this:

  auto value = create_value();
  if (some_cond) {
    consume_value(std::move(value)); // not sure whether it's move here, but I guess my point is clear
  }

  use_value(value);


My assumption is that this would produce a compiler error. Depending on whether or not the branch is taken, you would essentially be accessing an uninitialized value. Compilers already catch this type of case.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: