home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19705 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.6 KB  |  49 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!cs.utexas.edu!torn!utzoo!censor!animal!base!stam.qe.bell.ca!xinxu
  3. From: xinxu@stam.qe.bell.ca (Xin Xu)
  4. Subject: Re: Reference vs. Pointer
  5. Message-ID: <1993Jan20.193705.10482@base>
  6. Sender: xinxu@mars (Xin Xu)
  7. Nntp-Posting-Host: mars
  8. Organization: Telecom Canada E.D.S.
  9. References: <1993Jan15.175541.247@base> <dak.727298364@messua>
  10. Date: Wed, 20 Jan 1993 19:37:05 GMT
  11. Lines: 36
  12.  
  13. In article <dak.727298364@messua>, dak@messua.informatik.rwth-aachen.de (David Kastrup) writes:
  14. |> xinxu@stam.qe.bell.ca (Xin Xu) writes:
  15. |> 
  16. |> 
  17. |> >What does "reference variable" can do but "pointer variable" can't ?
  18. |> 
  19. |> You need not remember for every function argument, whether you got a
  20. |> pointer or not, when you do not change the argument.
  21. |> 
  22.  
  23. Sorry, I can not understand  your point here.
  24.  
  25. |> Functions can easily return lvalues. That is especially important
  26. |> for efficient implementation of classes like Complex, which would
  27. |> otherwise mangle up their syntax horribly.
  28. |> 
  29.  
  30. OK
  31.  
  32. |> The scope of the referenced variables can be cleanly determined by
  33. |> the compiler.
  34. |> 
  35.  
  36. what "cleanly" means here compared to "pointer" ?
  37.  
  38. |> You can pass structures by reference, just like arrays are always passed,
  39. |> thus making certain function calls much faster.
  40. |> 
  41.  
  42. I can pass structures by pointer too, and I can not see the speed problem 
  43. for using pointer.
  44.  
  45. |> Of course you can work around everything.
  46. |> Remember that c++ can do nothing that c already can (therefore, you can
  47. |> mechanically translate into c as with cfront), but the syntax
  48. |> and concepts are much more pretty and comprehensible.
  49.