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

Ah, but you knew that because that's how the code was written!

If it was instead

    String foo = "bar";
    auto baz = foo;
you don't know for sure. But the code compiles so it obviously ok!


No, I'm saying even in that case you know it was intended to be a copy. If you wanted that to be a reference then you'd either (a) just do the obvious thing which is to just use the original variable name instead of creating a new variable out of the blue for no reason, (b) leave a comment explaining why you're not doing the aforementioned obvious thing, or (c) use a self-explanatory variable name to provide the explanation instead of a comment.




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

Search: