How much different?


 
Thread Tools Search this Thread
Top Forums Programming How much different?
# 1  
Old 12-27-2003
How much different?

Well I have been a network admin over 4 years and am wanting to get more into programming, web development and database management. As such I have gone back to school for web development, during my classes I will take a part on C++ which I have been interested in learning. The question I basically have is how much deference is there between C and C++? Or would be learning one you can do the other or almost all of the other?

From what I have read so far C is more powerful but C++ is easier. If I have just been reading and not understanding well hey it wouldn't be the first time. The point is I'm coming up with some languages I would like to learn. So any help in this would be great thanks.

PS. If this topic is somewhere else I was unable to find it just make fun of me here and then post a link.
Smilie
# 2  
Old 12-27-2003
Re: How much different?

Quote:
Originally posted by Zivux
From what I have read so far C is more powerful but C++ is easier.
C++ encourages you to take on an object-oriented approach of programming, while with C you can only use the function-oriented (procedural) approach. New programmers generally prefer object-oriented approach. This enforces higher modularization and reusability of classes developed and is generally recommended; while sysadmins tend to prefer function-oriented approach as that is what sysadmins are used to doing in, for example, shell scripting.

C++ is a superset containing C. So learning C++ requires you to learn C as well, so you don't lose anything. Any C libraries can also be used from within C++ programs. I write C++ myself but I also use a lot of C libraries in my programs. For example, I am not really fond of the iostream classes in standard C++ library for I/O, and I use the C stdio functions instead; but in some other cases I may prefer an object-oriented library for some other purposes, say XML processing.

Whether C++ is easier compared with C is not really a quick yes/no question. To adopt an object-oriented style you are forced to divide the functionalities of your program into various objects. An optimal division may not be always intuitive if you would like to ensure a high degree of future extensibility.

Which one to choose is your decision. However, C++ is the trend, and that's why most colleges choose C++ rather than C, because object-orientedness is an important principle in software engineering to enforce code reuse and modularization makes debugging easier.
# 3  
Old 12-27-2003
C++ is almost a superset of C, but not quite.

I am a C programmer. However, I think that C compilers are too permissive. I strongly prefer to use a C++ compiler to develop my C code. C++ demands function prototypes while C does not. C++ is very pedantic about matching types with explicit casts while C doesn't care. Those two items catch about 95% of the errors that I make. By the time a C++ compiler compiles my code without warnings, I have a very good chance of having my program work correctly the first time that I run it. The only thing that I regretted giving up was a very few variable names. I think that "bool" was one.

I do go back and make sure that my code compiles with C compilers as well. The result is code that works with any C or C++ compiler.

I started this because I was on a system that had a C++ compiler, but no C compiler. I reluctantly used the C++ compiler and discovered that I loved writing C code with it. I would not be doing this if I felt that I was surrendering any power.

So am I a C++ programmer? I think that most C++ programmers would say "no", despite the fact that my programs are valid C++ code.

I hope that all of this helps you see the relationship between C and C++.
# 4  
Old 12-30-2003
This has been a lot of help thank you very much. I have been trying to come up with what programming that I wanted to learn and this was a question that always seemed to be implied as if everyone should already know the difference.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question