Jump to content
xisto Community
apache

C++ Or C Whats is to beter?

Recommended Posts

C++ is continuation of C. C++ is object-oriented. In my opinion classes are very useful. Today C++ is using to develope many programs, but e.g. kernels are written in C. I suggest using C++ then.

Share this post


Link to post
Share on other sites
http://graham.main.nc.us/~bhammel/graham/C.htmlI agree that c++ has more features and in that since it is better however you can program in an object oriented style in c. True it doesnt have classes but it has something called type definition and structures. You can implement methods by having fields in your structure that are pointers to void. You can implement subclasses by renaming an exciting type with a second type. Then you can override methods by changing the pointers. If you want to include new fields in the subclass then make sure there is a field in the original type called children. If you want to do multiple inheritance in c, which is legal in c++ but not java than the child would have to point to the parent instead of the parent pointing to the child. This will make polymorphism more difficult to handle. Anyway, anything that is legal in c is legal in c++ so it is not really hard to switch from c to c++. So why not switch? Arent more features better? Well it depends, not all processors have c++ compilers, c is a much smaller language, it is much easier to see what is going in at a low level with c then c++ because the translation from c to assembly is almost just a straight look up. Some programming environments that interface with hardware (ex. Lab windows) supports c and not c++. So if you know c you can use you code in more places but if you know c++ while your code will probably be easier to read. Take your pick.

The C Programming Language may have been one of the most elegant and beautiful computer languages ever devised; a personal opinion. I'm not sure how fond I am of the new ANSI standard for it. Let me describe the original C as designed by Ken Thompson and Dennis Ritchie.

From:http://graham.main.nc.us/~bhammel/graham/C.html

Share this post


Link to post
Share on other sites

The big step is to change the way of thinking. C++ forces to think you about the data the application is going to manage and C forces you to think about the goal to be achieved. A lot of people uses C++ as a C with more functionality. There is really few people who really use C++ in a pure oriented object way.I think that C is really powerful but C++ is even more powerful. However a lot software development is made in C. Maybe because is easier to find C programmers than C++ programmers.

Share this post


Link to post
Share on other sites

I don't think you're right Darth Vivi. Microsoft sells Visual C++and makes its OS mostly in C. But C is good in system programming,and C++ for your everyday programming since it gives everyonea bit more peace of mind. Personally I've seen C programs runfaster and smaller than C++ programs, but that's because C's moresystem oriented. Personally, I prefer C++. I'd use assembly ratherthan C nowadays.

Share this post


Link to post
Share on other sites

I'd use assembly ratherthan C nowadays.


Better control and more efficient but less portable. I think it would be better to write some libraries in assembler that take advantage of unique processor features and then call them from C or C++. You could even have a general C version of the libraries when you didn’t know what processor the code would be run on.

Share this post


Link to post
Share on other sites

I like C because it is the best way to learn other language..

C no more function - you can learn it by easy and can make some problem to clear (suitable for beginer).

C no strict - if you learn java or high language, you will known "how is strict ?".

and more... :P

 

Anyways!! my C complier has more bugs!! ;) , I don't know how i can fix it.

I must change!!! ;)

Share this post


Link to post
Share on other sites

Hey nancmu, which C compiler do you use?There are some assembly libraries out there,but none which does what you want s243a,after all, why sell out on assembly's good stuff? ;)

Share this post


Link to post
Share on other sites

Someone said C++ is just an everyday language. That's not actually true. C++ is an extension of C, and it's biggest addition is object orientation... that does not mean that C++ is not a systems language. I think you'll find that the reason why most system programming is done in C is because there's still a lot of old-school programmers who just can't get their heads around the object-orientation paradigm. For instance, I see "C++ programmers" still using C's printf() and other formatting functions and claim that it is superior to C++ iostream classes. With a bit of work, C++'s standard I/O can be used far more effectively than C's standard I/O... IMO.Yet, that said, I'd still not say that C is worthless, quite the opposite, actually. It still has its uses just as every language does.

Share this post


Link to post
Share on other sites

And the person that said C++ is an everyday language is me...
Well, I mean it in several ways. You could show C++ code to a
computer illiterate and C code and see which makes more sense.
But most people I know program in C++ as much as possible.

[/br]#include<iostream>[br]typecast googleit[/br]{[br] volatile int x = 1;[/br] bool y(int z)[br] { return !z;  //ok, !z I'm not sure you can return...}[/br]}[br][/br]int main()[br]{[/br] std::cout << "enabling sequence...." << end1;[br] std::cout << "sequence aborted!" << end1;[/br] std::cout << "error" << googleit::y(googleit::x);[br] return -1;[/br]}[br]
[br]#include <stdio>[/br]int volatile x = 1;[br]int function(int z)[/br] {  return !z;}[br]int main()[br]{[/br]printf("enabling sequence...\n");[/br]printf("sequence aborted!\n");[br]printf("error\n");   //ok I admit my memory of C is a bit shabby[/br]printf(y(x));[br]printf("\n");[/br]return -1;[br]}[/br]

Share this post


Link to post
Share on other sites
:P I see what you mean.... when I thought "every day language", I started thinking of C++ being compared as being like VB... ;) (my brain it burns at the thought... ;) )With the amount of C code out there, though, I really need to get around and actually learn what half of it does... as much as C++ is supposed to be born and bred from C, they still look soooo different.

Share this post


Link to post
Share on other sites

C++ ~= VB?! ;) Of course not.Good luck with your great crusade to understandall that C code. I've tried...and went back to relearningC.

Share this post


Link to post
Share on other sites

Wats the program is beter?

 

C++

 

C

<{POST_SNAPBACK}>


Its like apples and oranges. If you are really thirsty - or need vitamin C then orange is probably better. So - you have to think about what you want to do? If you really want to produce stuff quickly ( for windows ) then I think you would be better using Delph - its supberb and its really quick to learn and fast to use. C is much easier than C++ since its not object orientated - but object is only useful if you really sit down and plan your applicaiton carefully.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.