From: Floris van den Berg (flvdberg_at_[hidden])
Date: 2003-05-03 20:09:36
From: "Noel Yap" <Noel.Yap_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Sunday, May 04, 2003 2:37 AM
Subject: Re: [boost] Re: in/out parameters, codingstylesandmaintenance
> > references are safer in that they tend to mean, this data isn't
> > allocated,
> void f( T const& t_ );
> T* t = new T();
> f( *t );
> > you're not referencing and dereferencing.
> Like I said before, references are implicitly dereferenced pointers.
You are confusing language implementation with language definition. The
definition says a reference is an alias, meaning you don't check the
existance of the passed object. You don't have to check it because the
caller takes responsibility that the object in fact exists. There are
probably tons of ways to abuse references and to break the system, but
that's with every system. For example you can break use of const just as
easily via const_cast. That a reference is implemented as a pointer is just
a side effect that should be ignored for argument's sake.