By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,440 Members | 1,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,440 IT Pros & Developers. It's quick & easy.

Why should I learn C++?

100+
P: 208
So I've been programming for a while now. I'm fairly proficient in C, C# and Java. I know a bunch of scripting languages as well. Is there any reason for me to learn C++? I don't really know anything about the language.

What type of things is it good for? What can I do with it that I can't do with the others?


Thanks
May 25 '07 #1
Share this Question
Share on Google+
30 Replies


Savage
Expert 100+
P: 1,764
So I've been programming for a while now. I'm fairly proficient in C, C# and Java. I know a bunch of scripting languages as well. Is there any reason for me to learn C++? I don't really know anything about the language.

What type of things is it good for? What can I do with it that I can't do with the others?


Thanks
If u know C then u have a good base for learning C++,C++ is simple said C superset.

Why should u learn C++?

U know C# is .NET oriented and C++ is COM oriented.Computers can run on .NET but some other scraps from metal can't run it while they can run on COM

Savage
May 25 '07 #2

AdrianH
Expert 100+
P: 1,251
If u know C then u have a good base for learning C++,C++ is simple said C superset.

Why should u learn C++?

U know C# is .NET oriented and C++ is COM oriented.Computers can run on .NET but some other scraps from metal can't run it while they can run on COM

Savage
I thought that C++ can be used with .NET. .NET is just a library after all. I also thought that C# can use COM as well, but may require wrappers.


Adrian
May 25 '07 #3

AdrianH
Expert 100+
P: 1,251
So I've been programming for a while now. I'm fairly proficient in C, C# and Java. I know a bunch of scripting languages as well. Is there any reason for me to learn C++? I don't really know anything about the language.

What type of things is it good for? What can I do with it that I can't do with the others?


Thanks
C++ is similar to C# and Java but has its roots in C. The family tree probably looks something like this:
Expand|Select|Wrap|Line Numbers
  1. ---------------
  2. |   Assembly  |
  3. |       |     |
  4. |       C     |
  5. |       |     |
  6. |      C++    |
  7. |      /\     |
  8. |     /  \    |
  9. |  Java   \   |
  10. |     \   /   |
  11. |      \ /    |
  12. |       C#    |
  13. ---------------
A reason to learn it? Flexibility is one, it also has some interesting features in it that you may find interesting like templates (slightly different from Java ones which came out only farily recently) and algorithms.


Adrian
May 25 '07 #4

Savage
Expert 100+
P: 1,764
I thought that C++ can be used with .NET. .NET is just a library after all. I also thought that C# can use COM as well, but may require wrappers.


Adrian
Now i'm confused.

Please take a look at this

Savage
May 26 '07 #5

Expert 10K+
P: 11,448
C++ is the only language where "(a+b)/c" *can* mean that a Btree is to be split
over c more blocks when a chunk b is added to a tree a. Or it *can* mean that
you've just shot the enemy; or maybe it's just an addition and a division ...

kind regards,

Jos
May 26 '07 #6

AdrianH
Expert 100+
P: 1,251
C++ is the only language where "(a+b)/c" *can* mean that a Btree is to be split
over c more blocks when a chunk b is added to a tree a. Or it *can* mean that
you've just shot the enemy; or maybe it's just an addition and a division ...

kind regards,

Jos
Hey, if a programmer want to be an idiot and use operator overloading to make code unreadable, that is his/her business (and will be put out of business quite quickly since no one will hire such an idiot).

Operator overloading has legitimate uses. It should be used sparingly.


Adrian
May 26 '07 #7

AdrianH
Expert 100+
P: 1,251
Now i'm confused.

Please take a look at this

Savage
So what are you confused about?


Adrian
May 26 '07 #8

Banfa
Expert Mod 5K+
P: 8,916
C++ is similar to C# and Java but has its roots in C. The family tree probably looks something like this:
I believe the family tree is more like the image I have attached.

Note that modern standard C and C+ are more like siblings than descendents, both have features taken from the other language.
Attached Images
File Type: jpg languagetree.JPG (8.5 KB, 143 views)
File Type: gif languagetree.GIF (2.5 KB, 144 views)
May 26 '07 #9

P: 37
I believe the family tree is more like the image I have attached.

Note that modern standard C and C+ are more like siblings than descendents, both have features taken from the other language.
I don't know C++, but isn't one advantage to using C++ is something like memory management or memory allocation? Please collect me if I'm wrong.
May 26 '07 #10

AdrianH
Expert 100+
P: 1,251
I don't know C++, but isn't one advantage to using C++ is something like memory management or memory allocation? Please collect me if I'm wrong.
It is an advantage and disadvantage. Unfortunatly, there is no memory managment in standard C++. You have to do it yourself, which can be good or bad (but when bad, really bad).


Adrian
May 26 '07 #11

AdrianH
Expert 100+
P: 1,251
I believe the family tree is more like the image I have attached.

Note that modern standard C and C+ are more like siblings than descendents, both have features taken from the other language.
Your diagram is better than mine. But I still think that Java came out of C++.

As for C and C++ being siblings? Dunno if I agree. C++ was first written as a translator to C (think CFront). Now, C and C++ are fairly different with the newer C99 standard. Though I think that C++ standard will be bringing them in to line.


Adrian
May 26 '07 #12

Expert 10K+
P: 11,448
Your diagram is better than mine. But I still think that Java came out of C++.

As for C and C++ being siblings? Dunno if I agree. C++ was first written as a translator to C (think CFront). Now, C and C++ are fairly different with the newer C99 standard. Though I think that C++ standard will be bringing them in to line.


Adrian
There's no Objective C in that little picture; it's somewhere near C++, also a C
descendant. Java has 'borrowed' quite some concepts from Objective C; just like
C# 'borrowed' ideas from Java; it's a pity only Apple and a bit of GNU uses it;
it's the poor man's SmallTalk using C in a very sensible way.

And there's more lacking in that picture: BCPL is a descendant from CPL which
in turn used a lot of ideas invented in the Algol (60 and 68) family. Assembly
language isn't a direct predecessor from BCPL, nor Algol; and then there's Lisp,
the assembly language for Artificial Intelligence. ;-)

kind regards,

Jos
May 26 '07 #13

Banfa
Expert Mod 5K+
P: 8,916
BCPL is a descendant from CPL
damn, new I'd missed something, although as it turns out I'd missed somethings.

In many ways no language descends from assembler, it was what was there, languages came about because assembler is not terribly easy to use, and of course has no cross platform portability.
May 26 '07 #14

Banfa
Expert Mod 5K+
P: 8,916
As for C and C++ being siblings? Dunno if I agree. C++ was first written as a translator to C (think CFront). Now, C and C++ are fairly different with the newer C99 standard. Though I think that C++ standard will be bringing them in to line.
I am sure that C++ chronologically came 2nd and I am aware that the first C++ compilers were actually translators to C.

However the diagram is meant to show how languages relate to each other intellectually (i.e. the ideas from which ones influenced which other ones) and from this point of view it is impossible to say Standard C++ descended from Standard C or the other way around, there has been quite a lot of interchange of ideas.
May 26 '07 #15

drhowarddrfine
Expert 5K+
P: 7,435
Here are some old notes I've had lying around for a while:
there is very little reason to switch from straight C to C++ without virtual functions. Without virtual functions, C++ wouldn't be object-oriented. virtual functions are still at the heart of object-oriented programming using C++.
Also, the creator of C++, Bjarne Stroupe, says C++ is not a superset of C and shouldn't be thought of as such. I'll have to look for that.
assembler is not terribly easy to use, and of course has no cross platform portability.
Everything should be done in assembly.
May 26 '07 #16

AdrianH
Expert 100+
P: 1,251
Here are some old notes I've had lying around for a while:

Also, the creator of C++, Bjarne Stroupe, says C++ is not a superset of C and shouldn't be thought of as such. I'll have to look for that.
Yeah, yeah, and humans aren't related to apes. C++ has so many linguistic similarities to C, that it is fairly easy to see that they are related. Superset or not, C++ took a lot from C.


Everything should be done in assembly.
I think we have had this discussion... ;)


Adrian
May 26 '07 #17

AdrianH
Expert 100+
P: 1,251
I am sure that C++ chronologically came 2nd and I am aware that the first C++ compilers were actually translators to C.

However the diagram is meant to show how languages relate to each other intellectually (i.e. the ideas from which ones influenced which other ones) and from this point of view it is impossible to say Standard C++ descended from Standard C or the other way around, there has been quite a lot of interchange of ideas.
Maybe there is something to be said for the intellectual influence, but I think that even then, I still think that originally, C++ took from C (and possibly others) and later on, it may have also swung the other way.


Adrian
May 26 '07 #18

drhowarddrfine
Expert 5K+
P: 7,435
I guess I misremember. From Bjarne's site and FAQ:
C++ is a direct descendant of C that retains almost all of C as a subset.
Elsewhere he said C++ was originally known as "C with classes".

But he also says this when asked if C is a subset of C++:
In the strict mathematical sense, C isn't a subset of C++. There are programs that are valid C but not valid C++ and even a few ways of writing code that has a different meaning in C and C++. However, C++ supports every programming technique supported by C. Every C program can be written in essentially the same way in C++ with the same run-time and space efficiency.

Thus, C++ is as much a superset of ANSI C as ANSI C is a superset of K&R C and much as ISO C++ is a superset of C++ as it existed in 1985.

Except for a few examples ... C++ is a superset of C.
Here is his answer to the question, "Should I learn C before I learn C++?".
Knowing C is a prerequisite for learning C++, right?
Wrong. The common subset of C and C++ is easier to learn than C. There will be less type errors to catch manually (the C++ type system is stricter and more expressive), fewer tricks to learn (C++ allows you to express more things without circumlocution), and better libraries available. The best initial subset of C++ to learn is not "all of C".
May 26 '07 #19

Savage
Expert 100+
P: 1,764
So what are you confused about?


Adrian
This two posts confuse me:

Don't forget that lots of industries use fault tolerant, mission critical and often
real time systems. None of them are PCs, no matter the OS installed on them.

All that other metal doesn't run .NET; they do run C or C++ though. You don't
want managed code when you just have a few micro seconds (or less) to
respond to some external signal reliably according to an SLA.

The two are just disjunct different worlds and IMHO it will take a long long time
before the twain shall meet.

kind regards,

Jos
and
I thought that C++ can be used with .NET. .NET is just a library after all. I also thought that C# can use COM as well, but may require wrappers.


Adrian
Savage
May 26 '07 #20

AdrianH
Expert 100+
P: 1,251
So what are you confused about?


Adrian
This two posts confuse me:

Don't forget that lots of industries use fault tolerant, mission critical and often
real time systems. None of them are PCs, no matter the OS installed on them.

All that other metal doesn't run .NET; they do run C or C++ though. You don't
want managed code when you just have a few micro seconds (or less) to
respond to some external signal reliably according to an SLA.

The two are just disjunct different worlds and IMHO it will take a long long time
before the twain shall meet.

kind regards,

Jos
and
I thought that C++ can be used with .NET. .NET is just a library after all. I also thought that C# can use COM as well, but may require wrappers.


Adrian
Savage
How do they confuse you? Are you confused about .NET being a library framework? Are you confused that C++ and C# can both use .NET? Are you confused about C# not being used in realtime embedded systems (yet)?

What are you confused about?


Adrian
May 26 '07 #21

Savage
Expert 100+
P: 1,764
Are you confused about C# not being used in realtime embedded systems (yet)?
This is what cofuses me.

Look at this part:

None of them are PCs, no matter the OS installed on them.

All that other metal doesn't run .NET; they do run C or C++ though
Which means that C# is only .NET oriented and C or C++ COM oriented.

Savage
May 26 '07 #22

Expert 10K+
P: 11,448
This is what cofuses me.

Look at this part:



Which means that C# is only .NET oriented and C or C++ COM oriented.

Savage
There's are different types of computers than PCs or Macs; those other
machines know nothing about .NET or COM or whatever Microsoftism.
C++ and C run fine in those other environments; C# doesn't even exist there.

kind regards,

Jos
May 27 '07 #23

Savage
Expert 100+
P: 1,764
There's are different types of computers than PCs or Macs; those other
machines know nothing about .NET or COM or whatever Microsoftism.
C++ and C run fine in those other environments; C# doesn't even exist there.

kind regards,

Jos
Aha,thanks Jos!

Savage
May 27 '07 #24

P: 2
Hi Silent1Mezzo,
not that i could help you to answer if you should learn c++.
This was the original question wasn´t it ? Have you found out during this thread ?
Jun 3 '07 #25

AdrianH
Expert 100+
P: 1,251
I believe the family tree is more like the image I have attached.

Note that modern standard C and C+ are more like siblings than descendents, both have features taken from the other language.
BTW, Banfa, what did you use to generate the graphs? The dot language? Or something else?


Adrian
Jun 3 '07 #26

weaknessforcats
Expert Mod 5K+
P: 9,197
There's are different types of computers than PCs or Macs; those other
machines know nothing about .NET or COM or whatever Microsoftism.
C++ and C run fine in those other environments; C# doesn't even exist there.
You just said it: No C# on those machines.

You are aware, I hope, that the MSIL language used by the Microsoft CLR to interpret C# code is public domain? That means all you need do is write your own CLR for one of those other machines and BOOM! all existing Microsoft .NET code will execute.

Microsoft will not write those CLRs due to monopoly issues. But you can. And that would be the foundation of a real business.
Jun 3 '07 #27

Banfa
Expert Mod 5K+
P: 8,916
BTW, Banfa, what did you use to generate the graphs? The dot language? Or something else?
Paint initially, then when the image proved to be too large I used The GIMP to edit it (I think).

Those are the 2 graphics packages I use, both free. The only thing I have against The GIMP is it really is for manipulating images that already exist, if you wanted to create a new image and draw a circle on it that would be quite hard in The GIMP, very good apart from that.
Jun 3 '07 #28

Banfa
Expert Mod 5K+
P: 8,916
You are aware, I hope, that the MSIL language used by the Microsoft CLR to interpret C# code is public domain? That means all you need do is write your own CLR for one of those other machines and BOOM! all existing Microsoft .NET code will execute.
Why on earth would anyone want to muddy up a nice clean embedded environment by writing a .NET interpreter for it.

Actually I realise that what Jos references includes a whole raft of platforms that are not embedded but all the same, I am sure they are all running very nicely with and MS garbage muddying the waters. Why would you want to cripple a system by introducing MS bloat code.
Jun 3 '07 #29

AdrianH
Expert 100+
P: 1,251
Paint initially, then when the image proved to be too large I used The GIMP to edit it (I think).

Those are the 2 graphics packages I use, both free. The only thing I have against The GIMP is it really is for manipulating images that already exist, if you wanted to create a new image and draw a circle on it that would be quite hard in The GIMP, very good apart from that.
I use GIMP. Don't find that very difficult drawing a circle or making a new image. I like the layering stuff you can do with it (that is how I generated my Avatar). Unfortunately, you cannot manipulate it using vectors, though I've not played with the line drawing stuff in it.

I also use paint when I don't want or need overkill. And then I use ASCII art when I feel that graphics are overkill. ;)


Adrian
Jun 3 '07 #30

AdrianH
Expert 100+
P: 1,251
Why on earth would anyone want to muddy up a nice clean embedded environment by writing a .NET interpreter for it.

Actually I realise that what Jos references includes a whole raft of platforms that are not embedded but all the same, I am sure they are all running very nicely with and MS garbage muddying the waters. Why would you want to cripple a system by introducing MS bloat code.
Doesn't Java have virtual machines for some embedded stuff? It is the same idea. I thought I mentioned it.


Adrian
Jun 3 '07 #31

Post your reply

Sign in to post your reply or Sign up for a free account.