May 2012 Archives

Rvalue references

From the C++11 FAQ, section on rvalue references, about a simple incrementation function incr:

If that incr(0) were allowed either some temporary that nobody ever saw would be incremented or - far worse - the value of 0 would become 1. The latter sounds silly, but there was actually a bug like that in early Fortran compilers that set aside a memory location to hold the value 0.

That actually made me think about that nifty one-liner:

perl -wE 'Internals::SvREADONLY(${\undef},0);undef=42;say undef'

About Rafaël Garcia-Suarez

user-pic I can haz Perl.