Mail Archives: djgpp/1998/06/21/22:09:46
Andrew Deren wrote:
>
> Actually I would disagree with that. Pascal var passing is like c++ pass
> by reference. Passing a pointer is different than passing a reference.
>
> (I agree that this is more for comp.lang.c)
Actually, your particular point is more for comp.lang.c++, since C
doesn't support pass-by-reference. Internally, it's all done via
pointers anyway, regardless of the particular language syntax.
There is no functional difference between:
void addp( int *i1, int i2 )
{
*i1 += i2;
}
and
void addr( int &i1, int i2 )
{
i1 += i2;
}
They are identical for all intents and purposes, except that in addp(),
the thing i1 points to can be modified.
--
---------------------------------------------------------------------
| John M. Aldrich | "Sin lies only in hurting other |
| aka Fighteer I | people unnecessarily. All other |
| mailto:fighteer AT cs DOT com | 'sins' are invented nonsense." |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -