learning Modern C++

A

arnuld

Greg said:
Indeed, we're probably way off from the OPs questions at
this point, but COBOL ain't dead.

Ok, i tried both books [ Stroustrup & Eckel ] & finally after much
*work* i gave up. i think i also lack on experience. reverting to my
*unmanaged* bundle of C++ Primer 4/e.

still, i will be here for any comments or advice.

thanks
 
A

arnuld

arnuld said:
Greg Comeau wrote:
Indeed, we're probably way off from the OPs questions at
this point, but COBOL ain't dead.

Ok, i tried both books [ Stroustrup & Eckel ] & finally after much
*work* i gave up. i think i also lack on experience. reverting to my
*unmanaged* bundle of C++ Primer 4/e.

still, i will be here for any comments or advice.

SORRY for multiple-posts. that happened because of the
disgusting-internet connection i have.
 
G

Greg Comeau

Greg Comeau wrote:
Indeed, we're probably way off from the OPs questions at
this point, but COBOL ain't dead.

Ok, i tried both books [ Stroustrup & Eckel ] & finally after much
*work* i gave up. i think i also lack on experience. reverting to my
*unmanaged* bundle of C++ Primer 4/e.

still, i will be here for any comments or advice.

You tried both books in what 24 hours? Programming requires
a lot of patience and head banging, even when dealing with some
of the better educational sources.

Anyway, I can tend to "feel your pain". I would suggest
having a look at http://www.comeaucomputing.com/booklist
and seeing which of the "softer" introductions rub you the
right way, making note that many of them are not perfect
either (more inacurracies, especially that never get fixed,
as well as less insights, which IMO are vital).
 
A

arnuld

Greg said:
You tried both books in what 24 hours? Programming requires
a lot of patience and head banging, even when dealing with some
of the better educational sources.

NO, not 24 hours. i read "Ecekel" for more than 1 month continuously &
trust me "knowing C" is not the prerequisite, the prerequisite is "you
must have programmed in C, for some time, at least"

Stroustrup: i banged my head with this book for 4-5 days & it is really
far-above my head. i feel he is some sort of Software Engineer who has
taken the responsibilty to solve the most important problems/issues of
Soft. Engg (notice i did not say CS). i say so because i *think* one
needs to have "2-5" years of experience of Software-Development besides
C, for understanding his book.
Anyway, I can tend to "feel your pain". I would suggest
having a look at http://www.comeaucomputing.com/booklist
and seeing which of the "softer" introductions rub you the
right way, making note that many of them are not perfect
either (more inacurracies, especially that never get fixed,
as well as less insights, which IMO are vital).

i lurked there & found you mentioned 4 books new to me & none of them
is available in India :-( thanks anyway for the help.
Greg Comeau / 20 years of Comeauity!

i dont know but i want to ask: you are doing programming from last 20
years?
 
V

Victor Bazarov

arnuld said:
[..]
i lurked there & found you mentioned 4 books new to me & none of them
is available [..]

Just out of the blue, unrelated altogether, but I wanted to mention
an old Russian proverb: "He who wants to have things done, finds
a way, he who doesn't, finds an excuse".

V
 
A

arnuld

Just out of the blue, unrelated altogether, but I wanted to mention
an old Russian proverb: "He who wants to have things done, finds
a way, he who doesn't, finds an excuse".

do you really expect a novice to understand this:

template<class T>class vec : public vector<T> {
public:
Vec() : vector<T>() { }
Vec(int s) : vector<T>(s) { }

T& operator[](int i) { return at(i); }
const T& operator[](int i) const { return at(i); }
};

or this:

int add(CStash* s, const void* element) {
if(s->next >= s->quantity) //Enough space left?
inflate(s, increment);
// Copy element into storage,
// starting at next empty space:
int startBytes = s->next * s->size;
unsigned char* e = (unsigned char*)element;
for(int i = 0; i < s->size; i++)
s->storage[startBytes + i] = e;
s->next++;
return(s->next - 1); // Index number
}


i found the following way:

K&R2 > C Project > Eckel/Stroustrup > C++ Project

& trust me it really looks disgusting, C before C++. OK..., what path
you say?
 
A

Alf P. Steinbach

* arnuld:
NO, not 24 hours. i read "Ecekel" for more than 1 month continuously &
trust me "knowing C" is not the prerequisite, the prerequisite is "you
must have programmed in C, for some time, at least"

Stroustrup: i banged my head with this book for 4-5 days

I gave you the advice to do one page per day, /trying out things on your
computer for each page/.

In 4-5 days you should have completed 4-5 pages; that's not much to
judge a book by. If you have tried to go much faster then you don't
even have 4-5 pages assimilated. Perhaps just the equivalent of 1.

Keep in mind that no-one answering you here, and I include Greg (beg
forgiveness, Greg) and of course myself, consider themselves to know the
complete language, even after years and years of using it, and in Greg's
case, implementing the commercial compiler that most completely adheres
to the standard. And in one sense it's impossible to know the complete
language since new ambiguities, errors, self-contradictions and so on
are discovered in the standard all the time, so really, don't expect to
learn it in 4-5 days: expect to be able to do 4-5 pages, or thereabouts.
 
G

Greg Comeau

do you really expect a novice to understand this:
...

No. That would be unreasonable. But it would not be unreasonable
to expect a novice to:

1) Get more than one text
2) Be expected to read and reread paragraphs, sections, chapters
3) Go back to earlier chapters for info they didn't grasp first time
4) Try many of the examples gives by the author.
5) Try many of the exercises suggested by the author.
6) Spend hours and hours on it.
7) Take it slow
8) Understand that a tour of something is not necessarily a novice description
i found the following way:

K&R2 > C Project > Eckel/Stroustrup > C++ Project

& trust me it really looks disgusting, C before C++. OK..., what path
you say?

Personally I don't find it disgusting at all. But it may not be
optimal. Also, K&R can be very hard for many, even those who do
not find it hard.
 
A

arnuld

I gave you the advice to do one page per day, /trying out things on your
computer for each page/.

i did 11 pages in 4 days & i did do /every page/ with GCC, except for
the 11th one (where i got the trouble). 1 day i tried to do 10 pages &
then i went confused & frustrated & hence changed the idea from 10 to
2-3 only.
In 4-5 days you should have completed 4-5 pages; that's not much to
judge a book by.

my reply is not relevent to the problem but i am explaining anyway.

"my experience with other books says one must have read at least 60%
of the book before he can comment or make a review & i am not making
any review on /Stroustrup's book/".
Keep in mind that no-one answering you here

may be i am an idiot or i ask stupid questions? i am serious.
and I include Greg (beg
forgiveness, Greg) and of course myself, consider themselves to know the
complete language, even after years and years of using it, and in Greg's
case, implementing the commercial compiler that most completely adheres
to the standard. And in one sense it's impossible to know the complete
language since new ambiguities, errors, self-contradictions and so on
are discovered in the standard all the time, so really, don't expect to
learn it in 4-5 days: expect to be able to do 4-5 pages, or thereabouts.

i will tell you the *exact* reason why i am not able to learn from
"Eckel/Stroustrup". REASON is:

1.) why a function returns an /int pointer/ rather than an /int/ ?
2.) why a function takes arguments as: /const string& s, char c/ rather
than /string s, char *c/ or /string *s, const char *c/ etc. etc. ?

these 2 are the major hurdles for me. i am not able to understand their
example programmes because of these 2 issues. BUT at this point, is it
really necesary for me to understand these things?

-- arnuld
http://arnuld.blogspot.com
 
A

arnuld

Greg said:
No. That would be unreasonable. But it would not be unreasonable
to expect a novice to:

1) Get more than one text
2) Be expected to read and reread paragraphs, sections, chapters
3) Go back to earlier chapters for info they didn't grasp first time
4) Try many of the examples gives by the author.
5) Try many of the exercises suggested by the author.
6) Spend hours and hours on it.
7) Take it slow
8) Understand that a tour of something is not necessarily a novice description

YES, i am doing it now. i think i was not *hard* on myself. IOW, i was
not working hard enough. it is only because of Folks here /Stroustrup'
book/ that i have not lost hope, hence i took "4-5-6" onto me. but will
"7" not increase my learning-time to years?
Personally I don't find it disgusting at all. But it may not be
optimal. Also, K&R can be very hard for many, even those who do
not find it hard.

if not disgusting, then it must be *road to death*.
 
A

Alf P. Steinbach

* arnuld:
i will tell you the *exact* reason why i am not able to learn from
"Eckel/Stroustrup". REASON is:

1.) why a function returns an /int pointer/ rather than an /int/ ?

That would presumably be because the function stores the pointer
somewhere. Could alternatively be that the function modifies the
pointed to int (which there might be other pointers to). But in this
latter case a reference argument would usually be more appropriate.

2.) why a function takes arguments as: /const string& s, char c/ rather
than /string s, char *c/ or /string *s, const char *c/ etc. etc. ?

Using 'const string&' (or written another way, 'string const&', which
means the same) instead of just 'string' is an optimization which many
programmers do as a matter of course. The reason is that we know a
reference can be passed very efficiently, but we don't know that passing
a string by value can be done efficiently. It might be that with a
'string' argument type, the compiler will optimize things, but it might
also be that the string is time-consumingly copied; hence pass-by-ref.

these 2 are the major hurdles for me. i am not able to understand their
example programmes because of these 2 issues. BUT at this point, is it
really necesary for me to understand these things?

If you're using Stroustrup's TCPPPL it's best to go forward in the path
he's laid out. Meaning, that if he uses pointers, he'll have discussed
them first. So if just follow the book's path, you should be OK.

Please just /ask/, in new, problem-specific threads, whenever you find
you're stuck on something, and include (1) some real code, (2) what you
expected as result and why, and (3) what the actual result was instead.
 
V

Victor Bazarov

arnuld said:
YES, i am doing it now. i think i was not *hard* on myself. IOW, i was
not working hard enough. it is only because of Folks here /Stroustrup'
book/ that i have not lost hope, hence i took "4-5-6" onto me. but
will "7" not increase my learning-time to years?

It will. So? Many of us who use C++ professionally do not get to
employ all possible features of it in our daily programming/design.
That means many parts even when "learned" first, tend to slip away
and need to be re-learned years later, thus stretching the learning
curve significantly.

It is unrealistic to learn _all_ of C++ in less than a year (and have
a life at the same time). You cannot become an expert without
actually doing the stuff. And if you are doing it, you just don't
have enough hours in a day to do it all during one year (*and* have
a life)... So, either you give up living a normal life (which you
shouldn't) or you give up hope in becoming an expert in too short of
a time. I chose the latter. I am still learning.

V
 
N

Noah Roberts

arnuld said:
YES, i am doing it now. i think i was not *hard* on myself. IOW, i was
not working hard enough. it is only because of Folks here /Stroustrup'
book/ that i have not lost hope, hence i took "4-5-6" onto me. but will
"7" not increase my learning-time to years?

If it takes you longer than 6 months to learn C++ in its entirety you
may as well just give up and learn Java.
 
A

arnuld

Victor said:
It is unrealistic to learn _all_ of C++ in less than a year (and have
a life at the same time). You cannot become an expert without
actually doing the stuff. And if you are doing it, you just don't
have enough hours in a day to do it all during one year (*and* have
a life)... So, either you give up living a normal life (which you
shouldn't) or you give up hope in becoming an expert in too short of
a time. I chose the latter. I am still learning.

i only want to know, after going at this pace for 3 months will i be
able/eligible to contribute to some OpenSource project like "IceWeasel"
(by doing C++ coding) ? right now this is the only meaning i want to
have for doing *real-life-coding*.
 
V

Victor Bazarov

arnuld said:
[..]
i only want to know, after going at this pace for 3 months will i be
able/eligible to contribute to some OpenSource project like
"IceWeasel" (by doing C++ coding) ? right now this is the only
meaning i want to have for doing *real-life-coding*.

Nobody can answer this but you. And nobody knows the future, even
you. What usually happens is you put some effort into learning and
then the time comes to contribute. If you feel strong enough, you
will contribute. If you don't, you won't. It's not the end of the
world if you can't contribute to an open source project. Prioritise
your goals.

As to eligibility, I have no idea. Have you tried asking the project
lead (if any)?

V
 
A

arnuld

Alf said:
That would presumably be because the function stores the pointer
somewhere. Could alternatively be that the function modifies the
pointed to int (which there might be other pointers to). But in this
latter case a reference argument would usually be more appropriate.

did not understand, not even the single 1%.
Using 'const string&' (or written another way, 'string const&', which
means the same) instead of just 'string' is an optimization which many
programmers do as a matter of course. The reason is that we know a
reference can be passed very efficiently,

i did not know that
but we don't know that passing
a string by value can be done efficiently. It might be that with a
'string' argument type, the compiler will optimize things, but it might
also be that the string is time-consumingly copied; hence pass-by-ref.
understood.


If you're using Stroustrup's TCPPPL it's best to go forward in the path
he's laid out. Meaning, that if he uses pointers, he'll have discussed
them first. So if just follow the book's path, you should be OK.

OK, i will follow him.
Please just /ask/, in new, problem-specific threads, whenever you find
you're stuck on something, and include (1) some real code, (2) what you
expected as result and why, and (3) what the actual result was instead.

did that in a new thread.
 
A

Alf P. Steinbach

* arnuld:
did not understand, not even the single 1%.

That might be because I answered a question other than the one you
asked. Mea culpa.

Now, let's see, reading /slowly/: "/returns/ an int pointer".

Oh well, it's not possible to say why some unknown function returns an
int pointer. For any concrete example it might be possible to say.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top