Is pointer programming even necessary?

Discussion in 'C++' started by Danno, Mar 31, 2008.

  1. Danno

    Danno Guest

    I have decided that this year, I will refresh my C++ skills since they
    are old and brittle. I have moved onto other languages over the past
    10-15 years or so, and all the languages I have taken to don't have
    the pointer logic associated with it (Java, Ruby, etc). I can't say
    that I missed it. So my question is simple, is pointer programming
    still viable or even necessary?
    Danno, Mar 31, 2008
    #1
    1. Advertising

  2. Danno

    Kai-Uwe Bux Guest

    Danno wrote:

    > I have decided that this year, I will refresh my C++ skills since they
    > are old and brittle. I have moved onto other languages over the past
    > 10-15 years or so, and all the languages I have taken to don't have
    > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > that I missed it. So my question is simple, is pointer programming
    > still viable or even necessary?


    If you are asking about C++ (which can be inferred since you are posting
    here), then the answer is: Yes.

    The standard library offers a nice collection of useful data structures. So,
    you don't need explicit dynamic memory management anymore to use a doubly
    linked list.

    However, run-time polymorphism in C++ heavily relies on pointers. It is
    really on the level of pointer and reference types where the "is-a"
    relationship holds: if D derives from B, then the set of values for D* is a
    subset of the set of values for B*. (The canonical map from the set of
    values of type D to the set of values of type B is a projection not an
    inclusion, and it goes by the name of slicing.) Since references cannot be
    reseated, pointer still prove necessary at the very least in this context.

    Of course, there are other reasons to use pointers: e.g., T* can be used
    even for incomplete types, which sometimes makes it necessary to use T*
    instead of T in the context of template programming.


    Best

    Kai-Uwe Bux
    Kai-Uwe Bux, Mar 31, 2008
    #2
    1. Advertising

  3. * Danno:
    > I have decided that this year, I will refresh my C++ skills since they
    > are old and brittle. I have moved onto other languages over the past
    > 10-15 years or so, and all the languages I have taken to don't have
    > the pointer logic associated with it (Java, Ruby, etc).


    I think you mean "pointer arithmetic", because Java certainly have pointers.
    Java reference values are pointers. They're called pointers by the Java
    language definition (just consider what the heck you think a Java
    NullPointerException is all about), and they act like pointers.


    > I can't say that I missed it.


    Presumably, again, pointer arithmetic.


    > So my question is simple, is pointer programming
    > still viable or even necessary?


    Presumably, again, pointer arithmetic.

    Well, pointer arithmetic is necessary to build the foundations of languages such
    as Java.

    Any indexing operation or object field access reduces at a lower level to
    pointer arithmetic.

    It's incredible that you have programmed for 10-15 years and don't know this.

    A good dose of assembler programming seems in order! :)


    Cheers, & hth.,

    - Alf

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
    Alf P. Steinbach, Mar 31, 2008
    #3
  4. Danno wrote:
    > I have decided that this year, I will refresh my C++ skills since they
    > are old and brittle. I have moved onto other languages over the past
    > 10-15 years or so, and all the languages I have taken to don't have
    > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > that I missed it. So my question is simple, is pointer programming
    > still viable or even necessary?


    Do those languages offer the versatility of iterator-based generic
    algorithms? Can you, for example, use the exact same function to sort an
    array of integers and a double-ended queue of floats? Can you, for
    example, use the exact same function to iterate through an array of
    chars, a list of complex numbers or a balanced binary tree containing
    your own type of objects, and have to function return the sum of all the
    elements? Can you create your own innovative data container and have
    those exact same functions perform those operations on it?

    Ok, granted, I don't know if you can do that with Ruby. I know you
    can't do that with Java.
    Juha Nieminen, Mar 31, 2008
    #4
  5. Danno

    abir Guest

    On Mar 31, 6:30 pm, Juha Nieminen <> wrote:
    > Danno wrote:
    > > I have decided that this year, I will refresh my C++ skills since they
    > > are old and brittle. I have moved onto other languages over the past
    > > 10-15 years or so, and all the languages I have taken to don't have
    > > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > > that I missed it. So my question is simple, is pointer programming
    > > still viable or even necessary?

    >
    > Do those languages offer the versatility of iterator-based generic
    > algorithms? Can you, for example, use the exact same function to sort an
    > array of integers and a double-ended queue of floats? Can you, for
    > example, use the exact same function to iterate through an array of
    > chars, a list of complex numbers or a balanced binary tree containing
    > your own type of objects, and have to function return the sum of all the
    > elements? Can you create your own innovative data container and have
    > those exact same functions perform those operations on it?
    >
    > Ok, granted, I don't know if you can do that with Ruby. I know you
    > can't do that with Java.


    Why not? Java can (Though i don't know why it is not in Arrays ) and
    also ruby.
    They both define iterator. However in java iterators are little
    different than c++ , there is a single iterator to do the job, rather
    than 2.
    so where c++ iterators are like T* , java iterators are like C* (or c+
    + list kind of thing, or like intrusive containers ) or C& and
    size_type index (for random access containers) .
    So the abstraction level doesn't have any difference. However c++
    defines them through traits, hence non intrusive while java defines
    them as interface (Iterable, or a detailed JGL ). also Java and Ruby
    can't access locations directly in memory, but rather uses arrays,
    which is a language construct and implemented same way as c++ array
    (apart from value type & primitive)

    abir
    abir, Mar 31, 2008
    #5
  6. * Juha Nieminen:
    > Danno wrote:
    >> I have decided that this year, I will refresh my C++ skills since they
    >> are old and brittle. I have moved onto other languages over the past
    >> 10-15 years or so, and all the languages I have taken to don't have
    >> the pointer logic associated with it (Java, Ruby, etc). I can't say
    >> that I missed it. So my question is simple, is pointer programming
    >> still viable or even necessary?

    >
    > Do those languages offer the versatility of iterator-based generic
    > algorithms? Can you, for example, use the exact same function to sort an
    > array of integers and a double-ended queue of floats? Can you, for
    > example, use the exact same function to iterate through an array of
    > chars, a list of complex numbers or a balanced binary tree containing
    > your own type of objects, and have to function return the sum of all the
    > elements? Can you create your own innovative data container and have
    > those exact same functions perform those operations on it?
    >
    > Ok, granted, I don't know if you can do that with Ruby. I know you
    > can't do that with Java.


    I think you're wrong. ;-)

    Even if you meant to write "in a statically type safe way", well, Java has
    generics, not as powerful as C++ templates but, without being familiar with
    them, I'd think they'd be sufficient for that.

    Put that "I know you can't do that" together with the OP's wrongness about
    basics, and it gets really really wrong.


    Cheers, & hth.,

    - Alf

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
    Alf P. Steinbach, Mar 31, 2008
    #6
  7. Danno

    Danno Guest

    On Mar 31, 2:01 am, "Alf P. Steinbach" <> wrote:
    > * Danno:
    >
    > > I have decided that this year, I will refresh my C++ skills since they
    > > are old and brittle. I have moved onto other languages over the past
    > > 10-15 years or so, and all the languages I have taken to don't have
    > > the pointer logic associated with it (Java, Ruby, etc).

    >
    > I think you mean "pointer arithmetic", because Java certainly have pointers.
    > Java reference values are pointers. They're called pointers by the Java
    > language definition (just consider what the heck you think a Java
    > NullPointerException is all about), and they act like pointers.


    I was trying to be careful with the term, I did't think pointer
    arithmetic was the best term. Pointer arithmetic is when you use
    mathematical terms to manipulate the pointer (increment, decrement,
    comparison). In C++ you can do that, but I used the general term
    'pointer programming' so it can include pointer arithmetic as well as
    merely setting the reference. But this exercise in semantics isn't
    really my cause here.

    >
    > > I can't say that I missed it.

    >
    > Presumably, again, pointer arithmetic.
    >
    > > So my question is simple, is pointer programming
    > > still viable or even necessary?

    >
    > Presumably, again, pointer arithmetic.
    >
    > Well, pointer arithmetic is necessary to build the foundations of languages such
    > as Java.
    >
    > Any indexing operation or object field access reduces at a lower level to
    > pointer arithmetic.
    >
    > It's incredible that you have programmed for 10-15 years and don't know this.


    Whew, Damn it smells bad in here. That pomposity ought to be put
    away.

    >
    > A good dose of assembler programming seems in order! :)


    A good dose of humility can work wonders too. ;)

    >
    > Cheers, & hth.,
    >
    > - Alf
    >
    > --
    > A: Because it messes up the order in which people normally read text.
    > Q: Why is it such a bad thing?
    > A: Top-posting.
    > Q: What is the most annoying thing on usenet and in e-mail?
    Danno, Mar 31, 2008
    #7
  8. Danno

    Danno Guest

    On Mar 31, 1:07 am, Kai-Uwe Bux <> wrote:
    > Danno wrote:
    > > I have decided that this year, I will refresh my C++ skills since they
    > > are old and brittle. I have moved onto other languages over the past
    > > 10-15 years or so, and all the languages I have taken to don't have
    > > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > > that I missed it. So my question is simple, is pointer programming
    > > still viable or even necessary?

    >
    > If you are asking about C++ (which can be inferred since you are posting
    > here), then the answer is: Yes.
    >
    > The standard library offers a nice collection of useful data structures. So,
    > you don't need explicit dynamic memory management anymore to use a doubly
    > linked list.
    >
    > However, run-time polymorphism in C++ heavily relies on pointers. It is
    > really on the level of pointer and reference types where the "is-a"
    > relationship holds: if D derives from B, then the set of values for D* is a
    > subset of the set of values for B*. (The canonical map from the set of
    > values of type D to the set of values of type B is a projection not an
    > inclusion, and it goes by the name of slicing.) Since references cannot be
    > reseated, pointer still prove necessary at the very least in this context.
    >
    > Of course, there are other reasons to use pointers: e.g., T* can be used
    > even for incomplete types, which sometimes makes it necessary to use T*
    > instead of T in the context of template programming.
    >
    > Best
    >
    > Kai-Uwe Bux



    Thanks for your help Kai.
    Danno, Mar 31, 2008
    #8
  9. Danno

    Danno Guest

    On Mar 31, 7:30 am, Juha Nieminen <> wrote:
    > Danno wrote:
    > > I have decided that this year, I will refresh my C++ skills since they
    > > are old and brittle. I have moved onto other languages over the past
    > > 10-15 years or so, and all the languages I have taken to don't have
    > > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > > that I missed it. So my question is simple, is pointer programming
    > > still viable or even necessary?

    >
    > Do those languages offer the versatility of iterator-based generic
    > algorithms? Can you, for example, use the exact same function to sort an
    > array of integers and a double-ended queue of floats? Can you, for
    > example, use the exact same function to iterate through an array of
    > chars, a list of complex numbers or a balanced binary tree containing
    > your own type of objects, and have to function return the sum of all the
    > elements? Can you create your own innovative data container and have
    > those exact same functions perform those operations on it?
    >
    > Ok, granted, I don't know if you can do that with Ruby. I know you
    > can't do that with Java.


    Sure you can..All iterators in java are generic. Ruby is dynamic type
    so you can use a Enumerable mixin (like an interface) to make that
    object iterable. Then you can throw that to whatever you like since
    you duck-typing is very lenient.
    Danno, Mar 31, 2008
    #9
  10. Danno

    Danno Guest

    On Mar 31, 10:24 am, Danno <> wrote:
    > On Mar 31, 7:30 am, Juha Nieminen <> wrote:
    >
    >
    >
    > > Danno wrote:
    > > > I have decided that this year, I will refresh my C++ skills since they
    > > > are old and brittle. I have moved onto other languages over the past
    > > > 10-15 years or so, and all the languages I have taken to don't have
    > > > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > > > that I missed it. So my question is simple, is pointer programming
    > > > still viable or even necessary?

    >
    > > Do those languages offer the versatility of iterator-based generic
    > > algorithms? Can you, for example, use the exact same function to sort an
    > > array of integers and a double-ended queue of floats? Can you, for
    > > example, use the exact same function to iterate through an array of
    > > chars, a list of complex numbers or a balanced binary tree containing
    > > your own type of objects, and have to function return the sum of all the
    > > elements? Can you create your own innovative data container and have
    > > those exact same functions perform those operations on it?

    >
    > > Ok, granted, I don't know if you can do that with Ruby. I know you
    > > can't do that with Java.

    >
    > Sure you can..All iterators in java are generic. Ruby is dynamic type
    > so you can use a Enumerable mixin (like an interface) to make that
    > object iterable. Then you can throw that to whatever you like since
    > you duck-typing is very lenient.


    Correction, they are generic as of 5.0. Sorry. I got used to use to
    so much I always thought that they were there. ;)
    Danno, Mar 31, 2008
    #10
  11. Danno

    Danno Guest

    On Mar 31, 10:15 am, Danno <> wrote:
    > On Mar 31, 1:07 am, Kai-Uwe Bux <> wrote:
    >
    >
    >
    > > Danno wrote:
    > > > I have decided that this year, I will refresh my C++ skills since they
    > > > are old and brittle. I have moved onto other languages over the past
    > > > 10-15 years or so, and all the languages I have taken to don't have
    > > > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > > > that I missed it. So my question is simple, is pointer programming
    > > > still viable or even necessary?

    >
    > > If you are asking about C++ (which can be inferred since you are posting
    > > here), then the answer is: Yes.

    >
    > > The standard library offers a nice collection of useful data structures. So,
    > > you don't need explicit dynamic memory management anymore to use a doubly
    > > linked list.

    >
    > > However, run-time polymorphism in C++ heavily relies on pointers. It is
    > > really on the level of pointer and reference types where the "is-a"
    > > relationship holds: if D derives from B, then the set of values for D* is a
    > > subset of the set of values for B*. (The canonical map from the set of
    > > values of type D to the set of values of type B is a projection not an
    > > inclusion, and it goes by the name of slicing.) Since references cannot be
    > > reseated, pointer still prove necessary at the very least in this context.

    >
    > > Of course, there are other reasons to use pointers: e.g., T* can be used
    > > even for incomplete types, which sometimes makes it necessary to use T*
    > > instead of T in the context of template programming.

    >
    > > Best

    >
    > > Kai-Uwe Bux

    >
    > Thanks for your help Kai.


    Kai, I know where my problem came from.

    In java and ruby, object variables hold object references. I forgot
    in C++ that object variables hold object values. That means that
    pointers are absolutely necessary.

    Thanks again. That was the source of my confusion. ;)
    Danno, Mar 31, 2008
    #11
  12. * Danno:
    > On Mar 31, 2:01 am, "Alf P. Steinbach" <> wrote:
    >> * Danno:
    >>
    >>> I have decided that this year, I will refresh my C++ skills since they
    >>> are old and brittle. I have moved onto other languages over the past
    >>> 10-15 years or so, and all the languages I have taken to don't have
    >>> the pointer logic associated with it (Java, Ruby, etc).

    >> I think you mean "pointer arithmetic", because Java certainly have pointers.
    >> Java reference values are pointers. They're called pointers by the Java
    >> language definition (just consider what the heck you think a Java
    >> NullPointerException is all about), and they act like pointers.

    >
    > I was trying to be careful with the term, I did't think pointer
    > arithmetic was the best term.


    It was, if that was what you were referring to.

    You ended up being the opposite of careful.


    > Pointer arithmetic is when you use
    > mathematical terms to manipulate the pointer (increment, decrement,
    > comparison). In C++ you can do that, but I used the general term
    > 'pointer programming' so it can include pointer arithmetic as well as
    > merely setting the reference.


    Java does have pointers. What it lacks is pointer arithmetic, and the ability
    to form pointers in other ways than via new.


    > But this exercise in semantics isn't
    > really my cause here.


    It should be.

    It would be a good idea to understand, at least to some rough approximation,
    what you're attempting to ask about. :)


    Cheers, & hth.,

    - Alf
    Alf P. Steinbach, Mar 31, 2008
    #12
  13. On 2008-03-31 08:38, Danno wrote:
    > I have decided that this year, I will refresh my C++ skills since they
    > are old and brittle. I have moved onto other languages over the past
    > 10-15 years or so, and all the languages I have taken to don't have
    > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > that I missed it. So my question is simple, is pointer programming
    > still viable or even necessary?


    Viable, most certainly!

    Necessary? Not always, you can write quite a lot of programs these days
    without having to play with pointers. On the other hand, if you do use
    pointers you can much more with a lot less effort.

    --
    Erik Wikström
    Erik Wikström, Mar 31, 2008
    #13
  14. Danno

    Danno Guest

    On Mar 31, 10:45 am, "Alf P. Steinbach" <> wrote:
    > * Danno:
    >
    > > On Mar 31, 2:01 am, "Alf P. Steinbach" <> wrote:
    > >> * Danno:

    >
    > >>> I have decided that this year, I will refresh my C++ skills since they
    > >>> are old and brittle. I have moved onto other languages over the past
    > >>> 10-15 years or so, and all the languages I have taken to don't have
    > >>> the pointer logic associated with it (Java, Ruby, etc).
    > >> I think you mean "pointer arithmetic", because Java certainly have pointers.
    > >> Java reference values are pointers. They're called pointers by the Java
    > >> language definition (just consider what the heck you think a Java
    > >> NullPointerException is all about), and they act like pointers.

    >
    > > I was trying to be careful with the term, I did't think pointer
    > > arithmetic was the best term.

    >
    > It was, if that was what you were referring to.
    >
    > You ended up being the opposite of careful.
    >
    > > Pointer arithmetic is when you use
    > > mathematical terms to manipulate the pointer (increment, decrement,
    > > comparison). In C++ you can do that, but I used the general term
    > > 'pointer programming' so it can include pointer arithmetic as well as
    > > merely setting the reference.

    >
    > Java does have pointers. What it lacks is pointer arithmetic, and the ability
    > to form pointers in other ways than via new.



    What???? You just implied that java has pointer arithmetic. haha

    "I think you mean "pointer arithmetic", because Java certainly have
    pointers.
    Java reference values are pointers. They're called pointers by the
    Java
    language definition (just consider what the heck you think a Java
    NullPointerException is all about), and they act like pointers."




    >
    > > But this exercise in semantics isn't
    > > really my cause here.

    >
    > It should be.
    >
    > It would be a good idea to understand, at least to some rough approximation,
    > what you're attempting to ask about. :)
    >



    So I dusted off my Bjarne's C++ book and also referenced a few sites.
    Found out, you have no idea what you are talking about.
    I will just rely on the knowledgeable posters in this group. ;)

    Thanks
    Danno, Mar 31, 2008
    #14
  15. Danno

    Danno Guest

    On Mar 31, 11:26 am, Erik Wikström <> wrote:
    > On 2008-03-31 08:38, Danno wrote:
    >
    > > I have decided that this year, I will refresh my C++ skills since they
    > > are old and brittle. I have moved onto other languages over the past
    > > 10-15 years or so, and all the languages I have taken to don't have
    > > the pointer logic associated with it (Java, Ruby, etc). I can't say
    > > that I missed it. So my question is simple, is pointer programming
    > > still viable or even necessary?

    >
    > Viable, most certainly!
    >
    > Necessary? Not always, you can write quite a lot of programs these days
    > without having to play with pointers. On the other hand, if you do use
    > pointers you can much more with a lot less effort.


    Thanks Erik.
    >
    > --
    > Erik Wikström
    Danno, Mar 31, 2008
    #15
  16. Danno

    Guest

    On Mar 31, 12:56 pm, Danno <> wrote:
    > On Mar 31, 10:45 am, "Alf P. Steinbach" <> wrote:


    > > It would be a good idea to understand, at least to some rough approximation,
    > > what you're attempting to ask about. :)

    >
    > So I dusted off my Bjarne's C++ book and also referenced a few sites.
    > Found out, you have no idea what you are talking about.
    > I will just rely on the knowledgeable posters in this group. ;)


    Exactly what was it that Alf (who is indeed one of them most
    knowledgeable and courteous posters on c.l.c++) wrote was disproved by
    your few minutes of web surfing?

    Where are all of these brash newbies coming from lately?
    , Mar 31, 2008
    #16
  17. Danno

    Danno Guest

    On Mar 31, 12:06 pm, wrote:
    > On Mar 31, 12:56 pm, Danno <> wrote:
    >
    > > On Mar 31, 10:45 am, "Alf P. Steinbach" <> wrote:
    > > > It would be a good idea to understand, at least to some rough approximation,
    > > > what you're attempting to ask about. :)

    >
    > > So I dusted off my Bjarne's C++ book and also referenced a few sites.
    > > Found out, you have no idea what you are talking about.
    > > I will just rely on the knowledgeable posters in this group. ;)

    >
    > Exactly what was it that Alf (who is indeed one of them most
    > knowledgeable and courteous posters on c.l.c++) wrote was disproved by
    > your few minutes of web surfing?
    >


    Well, looking up 'Bjarne's C++ book' isn't necessarily web surfing,
    although I did do some web research on pointer arithmetic as well.

    Also, 'It's incredible that you have programmed for 10-15 years and
    don't know this.' isn't what I would call courteous or welcoming.

    I have found Kai's, Erik's, and Juha's responses very courteous and
    what I needed and in return I was courteous.


    > Where are all of these brash newbies coming from lately?


    I am sure, if some of the denizens of c.l.c++ were more apt to help
    than to insult out of the OP, they may not be so "brash". I know this
    is USENET, and you guys have your share of jerks and spam, but there
    is no reason to assume that of everyone.
    Danno, Mar 31, 2008
    #17
  18. Danno

    Guest

    On Mar 31, 1:19 pm, Danno <> wrote:

    >
    > Also, 'It's incredible that you have programmed for 10-15 years and
    > don't know this.' isn't what I would call courteous or welcoming.
    >
    > I have found Kai's, Erik's, and Juha's responses very courteous and
    > what I needed and in return I was courteous.
    >
    > > Where are all of these brash newbies coming from lately?

    >
    > I am sure, if some of the denizens of c.l.c++ were more apt to help
    > than to insult out of the OP, they may not be so "brash". I know this
    > is USENET, and you guys have your share of jerks and spam, but there
    > is no reason to assume that of everyone.


    I think you're taking this way too personally, and I don't consider
    Alf's comment to be an insult, just his opinion. And AFAICT, nobody
    accused your post of being spam or you being a jerk. I do think it's
    evident that you haven't read much of this group before posting or
    your opinion of Alf would be different perhaps.
    , Mar 31, 2008
    #18
  19. Danno

    Danno Guest

    On Mar 31, 1:30 pm, wrote:
    > On Mar 31, 1:19 pm, Danno <> wrote:
    >
    >
    >
    > > Also, 'It's incredible that you have programmed for 10-15 years and
    > > don't know this.' isn't what I would call courteous or welcoming.

    >
    > > I have found Kai's, Erik's, and Juha's responses very courteous and
    > > what I needed and in return I was courteous.

    >
    > > > Where are all of these brash newbies coming from lately?

    >
    > > I am sure, if some of the denizens of c.l.c++ were more apt to help
    > > than to insult out of the OP, they may not be so "brash". I know this
    > > is USENET, and you guys have your share of jerks and spam, but there
    > > is no reason to assume that of everyone.

    >
    > I think you're taking this way too personally, and I don't consider
    > Alf's comment to be an insult, just his opinion.


    You say that as if opinions and insults are exclusive.

    > And AFAICT, nobody
    > accused your post of being spam or you being a jerk.


    Never said that anyone did... I said that members here probably have
    their share of jerks and spam.

    > I do think it's
    > evident that you haven't read much of this group before posting or
    > your opinion of Alf would be different perhaps.


    That's hopefully obvious from my original post ;). I did look for
    other posts that may have an answer before posting.

    I hope that Alf and some other users takes some of my advice and offer
    up some civility and maybe some humility. There will always be a lot
    of noobs and people who have a new projects where a little or a lot of
    C++ is involved and/or will need a refresher. They may not be brash
    but only reacting to how they are treated and/or welcomed in this
    forum.

    I also hope that if you and Alf ever find yourself in a forum of
    another programming language (good to continually learn new
    languages ;) ) that you get treated respectfully and professionally
    like I how I was treated by you, Kai, Juha, and Erik on this thread.
    Danno, Mar 31, 2008
    #19
  20. * Danno:
    > On Mar 31, 10:45 am, "Alf P. Steinbach" <> wrote:
    >> * Danno:
    >>
    >>> On Mar 31, 2:01 am, "Alf P. Steinbach" <> wrote:
    >>>> * Danno:
    >>>>> I have decided that this year, I will refresh my C++ skills since they
    >>>>> are old and brittle. I have moved onto other languages over the past
    >>>>> 10-15 years or so, and all the languages I have taken to don't have
    >>>>> the pointer logic associated with it (Java, Ruby, etc).
    >>>> I think you mean "pointer arithmetic", because Java certainly have pointers.
    >>>> Java reference values are pointers. They're called pointers by the Java
    >>>> language definition (just consider what the heck you think a Java
    >>>> NullPointerException is all about), and they act like pointers.
    >>> I was trying to be careful with the term, I did't think pointer
    >>> arithmetic was the best term.

    >> It was, if that was what you were referring to.
    >>
    >> You ended up being the opposite of careful.
    >>
    >>> Pointer arithmetic is when you use
    >>> mathematical terms to manipulate the pointer (increment, decrement,
    >>> comparison). In C++ you can do that, but I used the general term
    >>> 'pointer programming' so it can include pointer arithmetic as well as
    >>> merely setting the reference.

    >> Java does have pointers. What it lacks is pointer arithmetic, and the ability
    >> to form pointers in other ways than via new.

    >
    >
    > What???? You just implied that java has pointer arithmetic. haha


    Nope.


    Cheers, & hth.,

    - Alf
    Alf P. Steinbach, Mar 31, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stan Goodman

    Even older fart, even newer newbie

    Stan Goodman, Jul 3, 2003, in forum: Java
    Replies:
    11
    Views:
    676
    Stan Goodman
    Jul 4, 2003
  2. JavaScriptJon
    Replies:
    11
    Views:
    548
    JavaJon
    Dec 15, 2005
  3. Uday Joshi
    Replies:
    5
    Views:
    373
    Dave Thompson
    Sep 1, 2003
  4. tm
    Replies:
    7
    Views:
    436
  5. Sam
    Replies:
    9
    Views:
    60
    Neil Cerutti
    Feb 18, 2014
Loading...

Share This Page