home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!cs.utexas.edu!torn!utzoo!censor!animal!base!stam.qe.bell.ca!xinxu
- From: xinxu@stam.qe.bell.ca (Xin Xu)
- Subject: Re: Reference vs. Pointer
- Message-ID: <1993Jan20.193705.10482@base>
- Sender: xinxu@mars (Xin Xu)
- Nntp-Posting-Host: mars
- Organization: Telecom Canada E.D.S.
- References: <1993Jan15.175541.247@base> <dak.727298364@messua>
- Date: Wed, 20 Jan 1993 19:37:05 GMT
- Lines: 36
-
- In article <dak.727298364@messua>, dak@messua.informatik.rwth-aachen.de (David Kastrup) writes:
- |> xinxu@stam.qe.bell.ca (Xin Xu) writes:
- |>
- |>
- |> >What does "reference variable" can do but "pointer variable" can't ?
- |>
- |> You need not remember for every function argument, whether you got a
- |> pointer or not, when you do not change the argument.
- |>
-
- Sorry, I can not understand your point here.
-
- |> Functions can easily return lvalues. That is especially important
- |> for efficient implementation of classes like Complex, which would
- |> otherwise mangle up their syntax horribly.
- |>
-
- OK
-
- |> The scope of the referenced variables can be cleanly determined by
- |> the compiler.
- |>
-
- what "cleanly" means here compared to "pointer" ?
-
- |> You can pass structures by reference, just like arrays are always passed,
- |> thus making certain function calls much faster.
- |>
-
- I can pass structures by pointer too, and I can not see the speed problem
- for using pointer.
-
- |> Of course you can work around everything.
- |> Remember that c++ can do nothing that c already can (therefore, you can
- |> mechanically translate into c as with cfront), but the syntax
- |> and concepts are much more pretty and comprehensible.
-