Hacker News new | ask | show | jobs
by AgentME 2371 days ago
New bindings live at different addresses (if you pass a pointer to one binding, and then make a new binding with a new value, the existing pointer will point to the old value and not the new binding's value) and bindings made in a loop iteration won't live to the next iteration.
1 comments

This sounds like an implementation detail. What does the language spec say about the outcome.
The (C) language spec says that:

  x = 5;
  int* p = &x;
  x = 6; // new binding of x
  printf("%i\n",*p);
prints "6". If new bindings lived at different addresses, it would print "5".
Different bindings are like entirely different variables that just coincidentally share the same name.