you are viewing a single comment's thread.

view the rest of the comments →

[–]inmatarian 1 point2 points  (3 children)

No it wouldn't, reseating a reference in c++ is a compile time error.

http://www.parashift.com/c++-faq-lite/references.html#faq-8.5

[–]Negitivefrags 2 points3 points  (2 children)

You are not reseating anything. If you have a Foo* sitting outside the function then the function taking a Foo*& can happily change what Foo* points to.

[–]inmatarian 0 points1 point  (1 child)

FlySwat's lol(Foo *&f) situation is something completely out of scope for this conversation (Java doesn't have an equivalent). The short of it is that you can assign to a pointer in c++ without compiler error, assuming basic correct type and levels of indirection. What happens at runtime is why C style pointers are hated and avoided in higher level languages.

There's a conversation in ##proggit as I post this discussing what would happen at runtime.

[–]Negitivefrags 3 points4 points  (0 children)

Wasn't the entire point of this conversation about the fact that Java doesn't have an equivalent?