Re: dont understand looping problem

From: Jesse Liberty (jliberty_at_libertyassociates.com)
Date: 10/10/04


Date: 10 Oct 2004 11:11:09 -0700


> i read the book TYC++ in 21 days(2nd edition) in bits and pieces but i
> can't comment on its accuracy of the C++ laguage as i myself don't
> know the complete C++ standard.
>
> (few things i can point out, like the author writes:
> 1)"In C++, passing by reference is accomplished in two ways: using
> pointers and using references"
> passing pointers is still pass by value.

A couple quick points. First, we're now on the 4th edition, and many
bugs and issues have been worked out. Second, I would argue that while
pointers are passed by value, this accomplishes the task of "passing
by reference" -- that is, you pass an object by reference by passing a
pionter to that object, and while a copy of the pointer is made in
the receiving method, both pointers refer to the same object on the
heap and thus you have, effectively, passed that object by reference.

My goal in these books is not to clutter them up with overly precise
advanced explanations (like the above) but rather to help the user
become productive and to achieve a working knowledge of the topic.
There are times that I sacrifice absolute (pedantic?) precision for
clarity. I plead guilty <smile>.

Some folks find that very helpful, others find it very aggrevating.

-j



Relevant Pages

  • Re: pointer syntax
    ... > really passing a reference (which is like an old-school pointer, ... > a copy of the primitive's value and passing that. ... build them yourself with pointers. ... mean a var parameter, write a var parameter. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Real World Flunks (Re: Why is Object Oriented so successful)
    ... AndyW wrote: ... "modeling the real world". ... CADD screen closely matches the object pointers in a typical real- ... I think the fact one has a reference to it ...
    (comp.object)
  • Re: programming concepts > specific languages
    ... > pointers if you are just doing java all along. ... Java has consistent, but non-intuitive, rules involving passing by ... value/passing by reference. ... A lot of beginning Java programmers don't ...
    (comp.programming)
  • Re: The Java no pointer big fat lie!
    ... > reference types, it wouldn't be a good comparison. ... and what you can't - and there is a big difference in Java to C and C++. ... You cannot change it in the language itself, ... Thus I would distinguish pointers from ...
    (comp.lang.java.programmer)
  • Re: no pointer in Java => my problem
    ... >> the value you are passing is an adress and you can't change the ... When passing a reference, you don't get ... > code anyway, where there are no pointers or references, just bit ... can design applications using objects and still implement them in C. ...
    (comp.lang.java.programmer)