Re: Terminology problem
From: Gary Labowitz (glabowitz_at_comcast.net)
Date: Mon, 7 Jun 2004 09:49:27 -0400
"David White" <firstname.lastname@example.org> wrote in message
> "Gary Labowitz" <email@example.com> wrote in message
> > "Edo" <edwardoJE@aking.com> wrote in message
> > news:firstname.lastname@example.org...
> > > Hello
> > > Is ( int &rVal = val; ) a declaration of a reference of type int
> > > the value of val
> > > Or
> > > A declaration of a variable rVal or type reference to int to the
> > > of val
> > int &rVal = val;
> > decalres a new name for the variable val. It is rVal.
> > You may now use rVal and val interchangeably.
> > rVal is called a reference to val. It exists as long as val exists; that
> > they share the same scope.
> They don't necessarily share the same scope. A reference can be born
> and die before, the object to which it refers, or it can refer to an
> that no longer exists. Obviously, you can't allow the latter case to ever
Yes, I spoke too quickly there, and misspoke. You are right. Generally,
however, the reference is declared in the scope of the referenced variable
or in a function declaration as a parameter. Same scope in the first case,
different scope in the second. Thanks.