473,804 Members | 2,946 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

learning Modern C++

hai all,

i am standing on a "crossroad to C++". I am here in front of you as i
have a problem. i will be brief. Please do not think: "arnuld is sick",
i am really struggling & doing hard-work to become a Modern C++
Programmer & i am feeling as if i am standing on a crossroad. i am
asking because every time i made a decision on my own, in my past, i
always ran into huge wastage of time, money & effort. that is why i am
posting it here:

--Problem-- as you folks know that i want to learn Modern C++ & in my
country "C++ Primer" 4/e & "Accelerate d C++" are not available & being
a jobless person i dont have money to order anything from abroad. i
have these books on my shelf:

1.) "Thinking in C++" 2/e
2.) "C++ Primer" 3/e
3.) "The C++ Programming Language" by Bjarne Stroustrup
4.) An illegal version of "C++ Primer" 4/e as a .chm file on my
Desktop.

i have these 5 options:

1.) read "C++ Primer 4/e" online: cant be done. with online copies
productivity goes down to 20%. reading "physically " really makes the
difference in understanding & learning the language.

2.) i took print-outs of 2-3-4 chapters of C++ Primer 4/e & read them &
found them excellent, though i took a while to understand. it has 800
pages, for me, it means 1000 pages of print outs from my EPSON
dot-matrix in 8 separate folders. it will be very difficult to learn
this way & what if i want to search for some phrase/ideas in C++, i am
"gone" in this case. i speak from experience, i tried this with
"Practical Common Lisp" & trust me, it was huge time wastage with much
less productivity & output (well, that is why Stroustrup created C++
:-)

3.) read "Bruce Eckel": tried that, he makes heavy-use of C. i dont
know C, i dont want to, i want C++.

4.) read "C++ Primer" 3/e: utterly incomprehensibl e to me.

4.) Learn C first -OOA & D book -C++. an excellent way to confuse
myself as i have found that learning "vectors, strings, new-delete"
1st, makes learning "C character arrays & free-malloc" much easier.
(while the opposite is not true, i tried it 2 months ago)

5.) Go directly with Stroustrup: +ve point is i will learn "Pure C++",
-ve point is i dont have any real-life coding experience, hence i found
it *too* dense & 50% of the times i did not understand what exactly he
was talink about. (but i do know what are variables, functions &
classes + strings, vectors, new delete from C++)

from all of this, i concluded Stroustrup is the only way to go. i just
need to dwell into it. what do you suggest?

thanks for your time

- arnuld
http://arnuld.blogapot.com

Oct 25 '06
78 4218
arnuld wrote:
>Daniel T. wrote:
>>ok, but what is the difference betwen using /int* x/ & /int x/ as an
argument to a function?

Generally, "int* x" refers to an array of ints or it serves as an
indicator that the called function must take responsibility for the
destruction (calling delete on) the object passed in.

Ok, you are talking about /arrays/ & /detruction/. so one uses /int*
x/, it means he is using Dynamic-Memory-Allocation instead of Static &
hence faster/efficient use of hardware. right?

/int* x/ refers to /arrays/. what does /int& x/ refers to?
I know it's difficult at the beginning, when you're just starting to
grasp the stuff, but try not to give into developing misconceptions.

Passing 'int*' just means passing an address of an integer, which can
actually be a null pointer. It also can be an address of a real int
variable or an address of an element in an array of int (or even the
address of an imaginary element "one-past-the-end" of an int array).

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 30 '06 #71
Victor Bazarov wrote:
I know it's difficult at the beginning, when you're just starting to
grasp the stuff, but try not to give into developing misconceptions.
ok, but does everyone faces such problems in the beginning?
Passing 'int*' just means passing an address of an integer, which can
actually be a null pointer. It also can be an address of a real int
variable or an address of an element in an array of int (or even the
address of an imaginary element "one-past-the-end" of an int array).
it looks like an approch to solve some problem. so it means, i will get
a better picture by solving some real-life problem.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 30 '06 #72
"arnuld" <ar*****@gmail. comwrote:
Daniel T. wrote:
ok, but what is the difference betwen using /int* x/ & /int x/ as an
argument to a function?
Generally, "int* x" refers to an array of ints or it serves as an
indicator that the called function must take responsibility for the
destruction (calling delete on) the object passed in.

Ok, you are talking about /arrays/ & /detruction/. so one uses /int*
x/, it means he is using Dynamic-Memory-Allocation instead of Static &
hence faster/efficient use of hardware. right?
One need not use dynamic allocation to warrant the use of int*. For
example:

void foo( int* values, int num )
{
for ( int i = 0; i < num; ++i )
cout << values[i] << " ";
cout << '\n';
}

void bar( int* consumable )
{
cout << *consumable << " consumed.\n";
delete consumable;
}

int main() {
int v[4] = { 10, 20, 30, 40 };
foo( v, 4 );
bar( new int( 12 ) );
}

/int* x/ refers to /arrays/. what does /int& x/ refers to?
int& (when not const) is generally used when the object passed in is
also being used for output. It serves as an alternate way to return
information. The calling code is expected to manage the lifetime of the
object. An example:

void foobar( int& x ) {
cout << "x currently equals " << x << '\n';
x = x + 22;
}

int main() {
int in = 2;
foobar( in );
cout << "'in' now equals " << in << '\n';
}
To send me email, put "sheltie" in the subject.

what is that?
If you want to email me, you can, but you have to put "sheltie" in the
subject of any email you send me. Otherwise my spam blocker will toss it
in the trash.

--
To send me email, put "sheltie" in the subject.
Oct 30 '06 #73

LR wrote:
Noah Roberts wrote:

If it takes you longer than 6 months to learn C++ in its entirety

Is this even a possible goal?
you
may as well just give up and learn Java.

Why? Is it possible to learn Java in six months in its entirety?
If you aren't an expert in Java in 21 days then maybe you're better off
flipping burgers.

Oct 30 '06 #74
"Victor Bazarov" <v.********@com Acast.netwrote:
Daniel T. wrote:
>>
Generally, "int* x" refers to an array of ints or it serves as an
indicator that the called function must take responsibility for the
destruction (calling delete on) the object passed in.

REALLY? <shaking his head in disbelief And I always thought that
it's because the integer needs to be filled in by the called
function, but the argument is essentially "optional". ..
Hmm... Look at your sentence again. The integer *needs* to be filled in,
but the argument is optional? How can the integer get filled in if it
doesn't exist?

I understand that int* can be use when one wants to allow passage of
nothing (i.e., NULL) but that is an extremely rare occurrence in my
experience.
>>why someone should prefer one over the other?

These are primarily minor issues of preference for the programer in
question. If, for example, you now ask between "int* x" and "int&
x" for a single 'x' object, I would have to say, "It depends on the
programer."

Damn! And I thought it depended on the task at hand... Damn!
Really? The only reason references were added to the language was to
facilitate operator overloading (D&E), in every other context where
references are used, one can use a pointer. So then, in those cases
where a reference can be used (other than operator overloads,) it is
purely a matter of programmer preference between use of a reference or a
pointer. I personally use pointers to indicate the passing of ownership
and reference when the called function doesn't want to accept ownership,
but that's just a style of mine, nothing in the language requires it.

--
To send me email, put "sheltie" in the subject.
Oct 30 '06 #75
Victor Bazarov wrote:
Since open source projects are not widely known by commercial companies,
having contributed to any of [potentially very obscure] OS projects may
not give you what you expect. Have you asked if OS projects will be
good enough for a company to consider it "experience "?
no, i just did a search on www.monsterindia.com. now, i will look for
email addresses of their "hiring managers" & will ask them.
As to not getting a job, have you tried talking to a recruiter? They
usually know much more of how to succeed in job seeking.
i live in a Town.no recruiters are here. i can go to a city but one is
at least 120km away & others are at least 370 kms. i will check if
anyone available online for the cities where there is an opprtunity to
work.
Prioritise your goals.
1.) [..book titles redacted..]


We'll call the above "learn enough C++ to get a job". Subgoals are
good to have.
5.) step 3 & half of 4 will take at least 6 mothst to 1 year.

That's not a goal. That's a risk.
did not get it.

Oct 30 '06 #76
arnuld wrote:
>[..]
>>5.) step 3 & half of 4 will take at least 6 mothst to 1 year.

That's not a goal. That's a risk.

did not get it.
What didn't you get? Are you setting a goal to spend a particular
amount of time on those? I see a statement saying "blah will take
so an so much time". That's called "risk assessment". Basically
you say, "We have time delay here before the task is complete; the
longer the delay, the more shit can happen and alter our universe,
so, the more time we allocate, the more risk we're taking (in shit
happening)". What goal are you setting here? Not to allow shit to
happen? You can't. You have very little influence on that (if at
all).

If you intended to limit yourself to a certain study period, then
you need to rephrase. Something like "spend no more than 6 months
on this before re-evaluating the list of goals", and make it part
of the goal describing studying. There has to be a set of
measurements that would help you understand whether the task has
been accomplished. Like, "I finish all exercises in book A and
50% of exercises in book B successfully". Or, "I join an open
source project and fix two bugs satisfactorily" . Otherwise, how
do you know you reached your goals?

We seem to be going waaaay off topic here. Perhaps you need to
get a copy of "management 101" textbook (or some such). That's
where they teach proper processes for setting goals and verifying
hitting them, and reviewing them, and...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 30 '06 #77

arnuld wrote in message
<11************ **********@e3g2 000cwe.googlegr oups.com>...
>Victor Bazarov wrote:
>I know it's difficult at the beginning, when you're just starting to
grasp the stuff, but try not to give into developing misconceptions.

ok, but does everyone faces such problems in the beginning?
No, because most of us read a book [1] instead of arguing on an NG!! :-}

Try:
'You Can Do It!' and "You Can Program in C++"
see http://www.spellen.org/youcandoit

Try some code. When you expect it to do "ahh", but it does "duh", and you
want help, this is the NG to consult.

[1] - ...the WHOLE book!!
example: In "Thinking in C++", Mr.Eckel will often show you how to do
something, but explain it much later in the book. You don't have 'the big
picture' until you hit the last page.
--
Bob R
POVrookie
Oct 30 '06 #78

"Victor Bazarov" <v.********@com Acast.netwrote in message
news:ei******** **@news.datemas .de...
arnuld wrote:
>>Greg Comeau wrote:
>>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?

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.
"do not get to"? Well, then you're a well-managed project then maybe
(read, someone enforces a coding standard, which of course should
indicate what C++ features will be allowed and how). I'm being facetious
because I don't believe anyone does that (the C++ feature leash thing)
(?), but I believe such a thing
would be not only good, but a boon (whatever a "boon" is!). The most
recent enlightening thing I've found was the coding standard that
B. Stroustrup's website has on it. That I'm going to reread every few
months until every good idea in it is in my own codebase.

So a coding standard like that is good, but controlling the zeal of
programmers that want to do magical stuff with the C++ mechanisms is
even more important. Someone is going to have to maintain that code
afterall, and many times it is not its creator. The concept of
"C++ on a leash" is a good one IMO.
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.
Those are probably the things that should be in the exclusion list!
It is unrealistic to learn _all_ of C++ in less than a year (and have
a life at the same time).
C++ is a smorgasbord, eat what you like.
You cannot become an expert without
actually doing the stuff.
That sounds like a focus on the intricate mechanisms rather than an
applied focus (actually building something simple and elegant).
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.
Personally, I think there are enough "language lawyers". How many are
really needed?? The names read like the C++ books at Borders. On my
shelf is Stroustrup, Coplien, Meyers, Koenig/Moo... and I've spent a lot
of time reading many passages of books at Borders.

I'll leave the above paragraph there, but now that I'm thinking about it,
I don't think I'd be able to afford any of those people to act as a lint
tool on my products' code before release. So yeah, there's probably a
lot of those kinds of people needed. Or some fancy tool from Parasoft?
I believe they had a tool that analyzed code for Meyer's "Effective C++"
best practices, yes?

Tony
Dec 13 '06 #79

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
330
by: kooolega | last post by:
Hi, that's me! I've decided to learn C++, but I'm still thinking about the books about C++. Which one is the best one and so on. I've made a list of books I'm going to read. I'd be glad if you checked it and told me your opinion. So, that's the list: 1. "Thinking in C++. Tom I" by Bruce Eckel 2. "Thinking in C++. Tom II" by Bruce Eckel and Chuck Allison 3. "C++ Unleashed" by Jesse Liberty 4. "C++ Gotchas: Avoiding Common Problems in...
3
2571
by: Sean McCourt | last post by:
Hi I am doing a JavaScript course and learning from the recommed book (JavaScript 3rd Edition by Don Gosslin) Below is one of the exercises from the book. I get this error message when I try to use the calculator. "document.Calculate.Input is null or not an object" Can someone please tell me why this is?
8
1970
by: Mantorok | last post by:
Hi all I'm looking to learn C and/or C++ and I was wondering if there were any good on-line resources and books. I am currently a C# developer but I'm keen to discover C/C++ as I feel it would be a benficial experience. Any suggestions?
4
1821
by: AmateurScripter | last post by:
I'm interested in learning C. What is the best way to learn this language? I know some JavaScript and know HTML very well. I can't afford any programs, but I can get books. What should I do?
26
3674
by: puzzlecracker | last post by:
It'd be interesting to compare the learning practices of c++ practitioners. I'll start with mine The C++ Programming Language C++ Primer Effective C++ More Effective C++ Effective STL The C++ Standard Library : A Tutorial and Reference (most of it) Exceptional C++
14
1658
by: master_programmer | last post by:
Hi I hope that I am posting to the right place. I want to learn programming and am looking at a language too choose. I thought about C++ but my friend told me thats its old fashioned and will be replaced by more modern computer languages like Visual Basic and Cold Fusion. Is it true that not many people use C++ anymore? What is the best language to learn?
3
1460
by: Niv | last post by:
Hi, I will shortly need to learn C or C++ as a high level hardware description language, modelling hardware at a more abstract level than VHDL. (I'm competent at VHDL & semi-competent at Tcl). I've done some minor dabbling in C before, but should I now, assuming I'm starting out afresh, start with C or go straight to C++. Will C give me a good grounding for C++ or add to my (likely) confusion? Regards, Kev P.
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.