Click to See Complete Forum and Search --> : Learning C
HairyMonkeyMan
February 11th, 2005, 05:40 AM
Hello,
I have been working with visual basic now for the last 4 years or so. I have decided that it is now time for me to get to grips with C/C#/C++.
I have a copy of Borland C/C++ and visual C++.
Have any C Gurus got any suggestions as to good reading materials that I could get into?
Also, which is your favourite version of C?
I've read in someone's sig that;
With C its easy to shoot yourself in the foot. With C++ its harder to do that, but when you do you blow your whole leg off :D
I have a sketchy knowledge of java which we rushed through in class. Is java similar to C?
Thanks for your time :wave:
Regards
Andreas Masur
February 11th, 2005, 05:54 AM
In short terms....get the book 'Accelerated C++' and start learning C++...forget about C... :cool:
ovidiucucu
February 12th, 2005, 08:42 AM
I've read in someone's sig that;
With C its easy to shoot yourself in the foot. With C++ its harder to do that, but when you do you blow your whole leg off :D
...and with Java is even harder but you can blow whole your boddy. :D
Well, start learning C++ as Andreas already said, then you'll understand what Bjarne meant.
yiannakop
February 12th, 2005, 09:28 AM
I (partly) disagree with ovidiucucu and Andreas. I am not a guru in programming, I just use C, C++, Matlab and Java for scientific purposes (image & video processing, pattern recognition etc). What I have understood is that C++ and Java are much more "flexible". The problem is that they are quite SLOW for computational programming:
- java is really slow (everybody knows that...)
- C++ (when using STL, at least in windows) is very-very slow
I am currently using C for computations for video processing and I find it easy to make real-time algorithms. I've used C++ for speech recognition and it was as fast as matlab was ( :sick: ) and Java for image processing (it was also very slow).
Anyway, to sum up, in my opinion object - oriented programming has lots of wonderfull things (like templates, operators overloading), even for computational programming but in most cases is much slower than pure C. So it depends on what you need that for. If you are a student and you will use programming for scientific purposes, then use some C. If not, C++ (and in my opinion better Java) are much better than C.
C book: Kerrnighan, Richie
ovidiucucu
February 12th, 2005, 09:46 AM
- C++ (when using STL, at least in windows) is very-very slow
Just curious.
STL in Unix, OS2, etc. is not so "very-very slow" like in Windows is?
YourSurrogateGod
February 12th, 2005, 12:03 PM
- C++ (when using STL, at least in windows) is very-very slow
Where did you hear that :ehh: ?
ovidiucucu
February 12th, 2005, 12:13 PM
- C++ (when using STL, at least in windows) is very-very slow
Perhaps C++ (when using STL, at least in windows) is very-very slow indeed, if running on 80486 computer with TURBO off. :D
cma
February 12th, 2005, 12:44 PM
- C++ (when using STL, at least in windows) is very-very slow
This is most likely an implementation issue with the particular compiler.
- java is really slow (everybody knows that...)
Some of Java's library routines (especially some of there math routines) are indeed slower then C/C++/Python's. However, Java's performance has improved over the years and many times, a Java program can run just as efficient as a C++ program.
YourSurrogateGod
February 12th, 2005, 01:46 PM
Some of Java's library routines (especially some of there math routines) are indeed slower then C/C++/Python's. However, Java's performance has improved over the years and many times, a Java program can run just as efficient as a C++ program.
That is true... especially when it comes to object creation, C++ is somewhat slower when it comes to this... from what I've heard.
Andreas Masur
February 13th, 2005, 04:49 AM
- C++ (when using STL, at least in windows) is very-very slow
Well...what do you mean with slow? The STL defines some default timing specs to which every implementation need to follow...so the run-time operation must be the same...
Anyway, to sum up, in my opinion object - oriented programming has lots of wonderfull things (like templates, operators overloading), even for computational programming but in most cases is much slower than pure C. So it depends on what you need that for. If you are a student and you will use programming for scientific purposes, then use some C. If not, C++ (and in my opinion better Java) are much better than C.
I don't want to argue about the topics you listed here, however, you are right in tha one should always choose the language based on the project. Nevertheless, my point was simply...in order to learn C++, I would not recommend to start with C first... ;)
Andreas Masur
February 13th, 2005, 04:54 AM
However, Java's performance has improved over the years and many times, a Java program can run just as efficient as a C++ program.
Well...performance and efficiency are two different things... ;)
ovidiucucu
February 13th, 2005, 05:03 AM
Take a look at Bjarne Stroustrup's FAQ (http://www.research.att.com/~bs/bs_faq.html).
cma
February 13th, 2005, 12:02 PM
Well...performance and efficiency are two different things... ;)
Well, when one speaks of efficiency, there's usually some notion of performance involved and vice-versa :cool:
Perhaps C++ (when using STL, at least in windows) is very-very slow indeed, if running on 80486 computer with TURBO off. :eek:
Why would anyone want to run Windows on a 486 in the first place? :confused:
I'd rather stick with DOS especially with TURBO off :rolleyes:
Also, if you still want to learn C, look into: C Primer Plus, 4th Edition by Stephen Prata, which is a relatively easy read.
Ben_Phillips
February 13th, 2005, 08:48 PM
Well-written C++ code is not much more inefficient to C. Many people think OO induces this gigantic code bloat, which is not the case. Obviously code will run slower than C, but in most cases the efficiency differences between the two will only matter in cases where heavy optimization is needed.
As for Java, obviously it runs slow when compared to other languages. It is platform independant to maintain its portability, some speed has to be sacrificed, but as with C++, well-written Java code can still get decent performance
Kheun
February 13th, 2005, 09:10 PM
I seconded Ben_Phillips. Code bloat and inefficiency are usually related to poor design and improper use of the language. For example, using virtual inheritance for all classes and passing parameter only by value. As C++ offers programming paradigm, like OO as well as GP, it allows us to cope with complexity and reuse much easier. This would translate into more time saved in software development.
Beside that, take a look at Blitz++ (http://www.oonumerics.org/blitz/whatis.html). It is supposed to provide performance on par with Fortran 77/90. Thus in IMHO, if C++ is inheritantly slow, such effort would not be undertaken in the first place.
yiannakop
February 17th, 2005, 04:34 AM
Ok, sorry guys if I was mistaken (I told you I am not a prof. programmer).
Also, I wanted to say I was wrong saying that STL makes the programs slower; what I wanted to say was that writting your own templates makes the program slower: most of the compilers (i used Visual C++ 6.0) need to have the decleration + implementation code in the header file (isn't that a reason to make the program slower?). I don't know maybe I did sth wrong then.
Andreas Masur
February 17th, 2005, 06:53 AM
Also, I wanted to say I was wrong saying that STL makes the programs slower; what I wanted to say was that writting your own templates makes the program slower: most of the compilers (i used Visual C++ 6.0) need to have the decleration + implementation code in the header file (isn't that a reason to make the program slower?). I don't know maybe I did sth wrong then.
Yes....that is still a typical problem with templates...there exists the 'export' keyword however this is basically supported by only a few compilers at the moment.
Nevertheless, the only time that these will slow down is the compilation time...but not the processing time....
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.