I understand what you were saying, (that you don't need pointers). But altering
code for the sake of an example as opposed to a real-world example isn't going
to do much. It might get across the intended idea after the author of the
example is done telling you that string is in fact char* as opposed to
std::string, etc. Changing the types helps no-one, least of all the person who
the example is for.
Pointers are a key part to c and c++, and you have to learn to live with them
eventually. This said, being able to read code that makes use of pointers is a
key skill. If you ever end up working on a big project that makes use of a
library most of these libraries tend to use pointers, and reading your own, or
other people's code is going to be needed to be able to easily work on the
project.
Thanks,
Tyler Littlefield
http://tds-solutions.net
Twitter: sorressean
On Mar 16, 2010, at 8:06 PM, Jimmy Johnson wrote:
> Let me respond to myself here. That sounds a little harsh. I should have
> started with, "I didn't explain this very well..." Sorry.
>
> --- In [email protected], "Jimmy Johnson" <boxer...@...> wrote:
> >
> > You missed the point. I never said, "You don't need pointers." Just the
> > point of the examples are not the pointers but the method of declaring a
> > type (as in my example about arrays). I am just saying that the point
> > (array declaration) gets lost in the pointers.
> >
> > Many of these examples seem to target novice users like me. I am just
> > suggesting a way to clarify example code for the new user.
> >
> > Okay, now I see where your comment about typedef-ing string came from. If I
> > wanted to teach a new Eiffel user about class ARRAY, I would avoid
> > complicated (to a new user) constructs. So, even though it is simple to me,
> > I would not use
> >
> > a: ARRAY [STRING]
> >
> > because class STRING is one of the few classes in Eiffel that give new
> > users a hard time. And I certainly would not start with
> >
> > a: ARRAY [ARRAY [STRING]]
> >
> > I want my use of the array (the point of the example) to not get obfuscated
> > (that's a C term isn't it?) by the type of the objects the array holds.
> >
> >
> > BTW, my code *is* full of pointers...and full of bugs too. [Relax, I don't
> > blame the bugs on the poiters--ust my poor use of them.] So back to work.
> >
> >
> >
> > --- In [email protected], Tyler Littlefield <tyler@> wrote:
> > >
> > > I'm not sure where the idea that you "don't need pointers in c++ comes
> > > from," as I've seen it here multiple times. Just because your learning
> > > c++ doesn't mean you won't use pointers, though, and being able to read
> > > the code is just as important as being able to write it. Everyone that
> > > writes code isn't going to typedef their strings for the people that
> > > don't understand how to read pointers. I don't want to come across as
> > > rude at all with it, but I really highly suggest you get used to the
> > > pointer idea. If you want to use a lot of different libraries, you'll end
> > > up using pointers sooner or later.
> > >
> > > Thanks,
> > > Tyler Littlefield
> > > http://tds-solutions.net
> > > Twitter: sorressean
> > >
> > > On Mar 16, 2010, at 10:16 AM, Jimmy Johnson wrote:
> > >
> > > > I just want to say thanks again to all the people on this forum who
> > > > have provided so much help to me. But I have a suggestion to those of
> > > > you who provide sample code and books.
> > > >
> > > > Don't use intergers as the central type in the demo.
> > > >
> > > > For example, when describing arrays most examples go something like
> > > > this:
> > > >
> > > > int my_array[10];
> > > >
> > > > or:
> > > >
> > > > int* my_array;
> > > > my_array = new int[10];
> > > >
> > > > As a non-C programmer I find this confusing; I can't separate the
> > > > pointers from the objects. Especially when the writer then goes into
> > > > the benifits of pointer arithmatic (of which it seems supporters of C
> > > > are very proud).
> > > >
> > > > Oh, and don't use strings either [char* is confusing too]. Use an
> > > > abstract type such as PERSON or MY_TYPE. So the example becomes:
> > > >
> > > > person my_array[10];
> > > >
> > > > Now it is easy for us non-c programmers to tell the difference between
> > > > an access to an object and a pointer manipulation.
> > > >
> > > > Just my two cents worth.
> > > >
> > > > Jimmy J. Johnson
> > > >
> > > >
> > >
> >
>
>
------------------------------------
To unsubscribe, send a blank message to
<mailto:[email protected]>.Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/c-prog/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/