Why do some people prefer C over C++?
-
James Brown wrote:
No, I implied nothing of the sort. get over it.
you said problems with complex programs in C are irrelevant, the primary and unrefutable reason for making C++ in the first place, is irrelevant because you only want to focus on the simplicity of the simpliest program. Data storage is irrelevant because a program will never store or use anything because you want to focus only on the simpliest usage of C, not real-world implimentation issues. libraries, complexites, only the bad behaviors you want to acknowledge are relevant, not the complexities and bad behaviors you don't want to acknowledge... well, sure, if you want to avoid the real-world coding problems, I agree wth you. So again, as long as you never have to write anything sufficiently complex or useful, never have to read anyone else's code, or store, or transmit, or exchange informaton with any routine or program. as long as you never actually do anything with your code, you are correct, C is better. But then... by the same logic, so is Assembly.
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
El Corazon wrote:
you said problems with complex programs in C are irrelevant
No, I did not. Learn to read. I *never* said that C was better, or worse than C++. You are reading huge amounts into my simple statement 'C is easier to learn' and are desperately trying to win an argument that doesn't exist, because I made no further comments as to which language was better or more useful.
-
James Brown wrote:
Do you know what constructors, and destructors are?
yes, and they have no side-affects. They exist and behave exactly as the definition has them and work quite well. So you obviously don't know how they work since you are now saying they must have side-effects?
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
once again, you are making absolutely no sense. I did *not* say that constructors and desctructors have side effects. Your attempt at reasoning appears to be non-existant. I have nothing further to say to you.
-
Christian Graus wrote:
The fact remains that given a *specific* task, C is no easier to learn to perform that task, it simply is less powerful and offers less options in terms of ways to approach it. If pure C code is the best way to tackle a specific problem, then you can write that code in C++.
yes, I agree absolutely. I was simply stating that C is simpler to learn than C++, and quite deliberately made no further comment as to which was the better language :-) It's usually much more work to write something in C compared with C++, and for this reason I usually choose C++ (or a subset of) to write things in. Plus the type-safety and all the other good things that the C++ language offers mean that it is much more useful than C. But, it is a right b****rd to learn fully.
OK - this I agree with 100%. I guess we were trying to say the same things, or at least things that were not opposed :-)
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
OK - this I agree with 100%. I guess we were trying to say the same things, or at least things that were not opposed :-)
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
C is like C++, with the fun removed. C++ is built on C, precisely so that it keeps the power of C, and so the language was likely to survive. C ruled the roost at the time. C may be a little faster, but not much. IMO, you'd be hard pressed to find a platform where C is sufficiently faster to warrant how much harder it is to write and maintain C code.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
embedded devices with limited resources, DOS my company develops applications for hand held portable devices that run windows CE and DOS. We are at our limit on what will fit in the executable. We have to keep C++ out of the code that will run on DOS.
-
In industry you will often find C being used for legacy reasons or in small systems where the tools don't support C++ so well.
Visit http://www.readytogiveup.com/[^] and do something special today.
#include using namespace std; int main() { cout<<"The person who told me that C does more than C++ came from the Robotics Team\n"; cout<<"and that C is the preferred choice for development.\n"; cout<<"Note: This is FIRST (usfirst.org), it is a regular High\n"; cout<<"School Club/Team, not something major like developing a product for the public.\n"; cout<<"Thanks for the input everyone.\n"; cout<<"Press Enter to Close Program.\n"; cin.get(); } Hmmmm....I don't think I'm that great of a programmer. :~ Could I have written that program better?
-
I've noticed that whichever one learns first, seems to be the preference. What about C++ bothers you the most?
_____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!
I'll take a stab! -Lack of a native, built in String type -Lack of any awareness of size of a dynamically allocated array -No understanding (at run time) of the difference between a pointer to an object (like a struct or class or primitive) and an array -dippy syntax that makes writing front end parsers (such as one would use for building analysis tools like lint, or a tool to generate class diagrams, etc) a total nightmare. C++ is one of the most difficult language to write a parser for when using tools like lexx/yacc/antlr, etc due to the convoluted syntax, which is why traditionally these tools have been lacking and slow to get built by the development community. I can't emphasize this enough -total lack of C++ Application Binary Interface (ABI) standard resulting in a total mess, and complete incompatibility between compilers -no real, useful RTTI, not even anyway to "toggle" it on or off via pragma, or compiler flags -a total lack of courage within the top tiers of the C++ community (hey Bjarne!) to publicly stand up and legitimately criticize vendors for poor compiler implementations.
¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog
-
I was told C could do more than C++ even though C++ is the "evolution" of C. In the sense that I'm programming with robots such as those in FIRST, I was also told that C is "closer" to the hardware. Are all of those true? Mind if someone tell me why he/she prefer C over C++? I'm so confused and lost. :confused:
C++ is superset of C and can do everything C can. However the difference between the current C language and C++ isnt so great as you might think so the superset that C++ is is only a bit bigger than C.
Truth is the subjection of reality to an individuals perception
-
C is like C++, with the fun removed. C++ is built on C, precisely so that it keeps the power of C, and so the language was likely to survive. C ruled the roost at the time. C may be a little faster, but not much. IMO, you'd be hard pressed to find a platform where C is sufficiently faster to warrant how much harder it is to write and maintain C code.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Christian Graus wrote:
harder it is to write and maintain C code
Very design dependant. C, using structures instead of classes is almost the same as C++. The difference is the lack of inheritance and making members private. So C can be easier to maintain than C++, particularly as it is simpler.
Truth is the subjection of reality to an individuals perception
-
James Brown wrote:
all the object-oriented trappings
Including Prolog and Smalltalk?
Visit http://www.readytogiveup.com/[^] and do something special today.