hi,
Could someone ans this for me its bugging me for a long time.
Is c++ a better c? If so why is c still being used? Tell me some uses as well.
please help.
Printable View
hi,
Could someone ans this for me its bugging me for a long time.
Is c++ a better c? If so why is c still being used? Tell me some uses as well.
please help.
In one sentence:
C++ adds some nice features, at the cost of some performance.
That's all a matter of opinion. In my opinion, it's an "of course it is." However, you will find some people who will disagree.
Why?
C++ is basically C but with a whole bunch extra. Just about anything you can do in C++ as well, even using the same syntax (in most cases), however C++ offers better type checking and an incredible amount of more built-in functionality.
One of the reasons C is still used a lot is because it's a hell-of-alot easier to make a C compiler than it is to make a C++ compiler. All of it's functionality is fairly low-level (for a high-level language).
C++, on the other hand, has a LOT more than that. On top of all that C has, it introduces of an entire new paradigm of programming. There is so much to the language of C++ that it's a lot more difficult and takes much more time to create a compiler for it than for C, and even still, there are very few compilers that can claim nearly 100% compliance to the C++ standard.
In short, most of the people who think think C++ isn't a better C think so because they feel that a simpler language is an easier to understand language is a better language (which actually ends up being quite the opposite on large-scale applications). It all comes down to opinion, though I feel very strongy, yes, c++ is definately a "better c" (and much much more than that).
I'd have to disagree with that to some extent. You can use the "C features" of C++ and get the same or better performance than of C (depending on the compiler). And when it comes to using member functions, it's potentially just as fast as passing the address of a structure in C. When it comes to virtual functions, you have to take into account the fact that in order to get similar functionality you'd have to either make your OWN vtable (which would give you most-likely the same, or less speed), or you'd have to set up enumerated values, etc.Quote:
Originally posted by Magos
C++ adds some nice features, at the cost of some performance.
In actuality, c++'s "C features" are potentially just as fast and there's no reason they can't be faster. It's impossible to compare the higher level features of C++ to C because there is no direct correspondence between functionality, however, if you tried to simulate the functionality in C manually, your results would most-likely be slower than that of a C++ compiler.
I started with C++ but after a while I changed to C because it is easier to understand and you can do all the same things like with C++(with C it take longer to write the same program, but the code is also easier to understand then the C++ code with classes and the other things)
I don't know wich tutorial you've taken, But C++ can acceptQuote:
Originally posted by PawelK
I started with C++ but after a while I changed to C because it is easier to understand and you can do all the same things like with C++(with C it take longer to write the same program, but the code is also easier to understand then the C++ code with classes and the other things)
C code, So you can just program C++ without classes and such
you don't understand.
>>Is c++ a better c?
In my opinion, big yes.
>>If so why is c still being used?
If there are so many better languages out there, why is FORTRAN still being used? :-)
> So you can just program C++ without classes and such
you don't understand.
Then you've thrown away the biggest bonus for using C++ in the first place.
I know, But he said he wen't programming C while he justQuote:
Originally posted by Govtcheez
> So you can just program C++ without classes and such
you don't understand.
Then you've thrown away the biggest bonus for using C++ in the first place.
could've stuck with C++ and just don't use C++ features he
doesnt understand, I dont get it.
And you are left still with C++'sQuote:
Originally posted by Govtcheez
> So you can just program C++ without classes and such
you don't understand.
Then you've thrown away the biggest bonus for using C++ in the first place.
Better type-checking
Templating
More expansive standard library (if you're okay with USING objects and just not creating classes)
Upgraded ?: operator
And a bunch more!
Sure classes are [arguably] the biggest bonus (some might say templating is), but there are still other reasons one would use c++.
>Is c++ a better c? If so why is c still being used? Tell me some uses as well.
I don't think one of the two is best. C is still used a lot, for example in embedded systems development.
Yes, of course, it's a superset of c (mostly a superset for those of you who might jump on me for not adding that). OOP and STL is what's going to allow programmers progress in the future while the size of programs continuously grows.Quote:
Originally posted by dark
Is c++ a better c?.
C++ is (in a lot regards) a different language. Old time C'ers may stick with what they like, rather than using C++.Quote:
Originally posted by dark
If so why is c still being used? Tell me some uses as well.
100% pure c may still be using in embedded systems programming, or in other instances that speed is a factor, but even c++ has taken over a considerable amount in those areas.
Another reason C is still being used is legacy code. C'er's will always be needed in that sense.
But as programs get more complex (and they always will), c will continue to be used less and less.
Since most application in c/c++ are windows programs, I can't see many coding in windows api for large scale projects for the future, which would force many c'ers to start moving into C++/MFC.
And I don't even want to get into the business aspects of why c++ would be used over c, but as you can all tell, I'm a c++'er :)
But those are just my opinions, I know I've been shot down for promoting c++ before, but I feel I'm correct.
Sorry, but I'm anti- C. (not C++!)
dark, when you ask that type of questions, you should always keep in mind that what might seem better to you, might be worse to some one else.
I think you should've asked, what is the difference between C and C++? And that question have been answered many times.
ammar i didn't want to know the difference between C and C++.Quote:
Originally posted by ammar
I think you should've asked, what is the difference between C and C++?
i think i did ask the right question and got the answers i needed. thankx for suggesting.
thankx everyone especially Terrance11(got a lot of info from you).
BTW: I think if you are asking to determine what language you are going to learn, you can simply learn both of them, because it's not difficult to learn one when you already know the other.