
"Peter Dimov" <pdimov@mmltd.net> writes: | Gabriel Dos Reis wrote: | > Jaakko Jarvi <jajarvi@cs.indiana.edu> writes: | > | >> My example was a bit contrived too. | >> Here's another example (with imaginary syntax): | >> | >> auto foo() { | >> int i; | >> return auto(int x) { return i + x; } | >> } | > | > Is it different from | > | > int& f() { int i; return i; } | > | > ? | | Yes, it's a bit different, since the reference return is explicit. I can I'm afraid, that changes nothing. From existing experiences. | choose between "int & f()" and "int f()" and the semantics are fairly | straightforward. If you think it is just a matter of ref, then about the value-based version int* f() { int i; return &i; } There is no bit of difference, actually. Unfortunately, it happens with people not noticing. [ That is how we get books that teach people not doing it :-) ] -- Gaby