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 > > > > > > > > >
