On Saturday, June 13, 2015 at 1:56:22 PM UTC+1, Stefan Ram wrote:
> Paul <
peps...@gmail.com> quotes:
> >const auto &j = 42; // ok: we can bind a const reference to a literal
>
> The reference is /not/ bound to the literal, but to the
> /value/ of the literal!
>
> Justification:
>
> A literal is a part of the source-code model, a value is a
> part of the run-time model. A reference is a part of the
> run-time model; it can only bind to other run-time entities.
>
> Example:
>
> const auto &i = 042;
> const auto &j = 0042;
>
> These are two different literals, but they have the same value.
> Where the references bound to the literals, it should be possible
> two see the difference between the literals using the references.
> But it is not. The reference are bound to the /values/ of the literals,
> and the values are the same, so the value of the references also
> is the same.
Thanks. The error is in the text I'm quoting from not mine (not that anyone said otherwise).
Paul