• C or C++?
    34 replies, posted
I heard C is better then C++ from a few of my friends? Is this true? I want to know which is better before I learn it. Opinions?
why did you have to ask this question... expect a few pages on a heated argument about it. good job edit i'm going to say C++ but i know i'll regret it
Seriously, I want to know where I should go next.
C [i]obviously[/i]
[quote=efex;18443046]c [i]obviously[/i][/quote] heretic
From what I understand, C is a bit lower level, yet C++ has better object support as far as ease of use and handling goes. C++ is better for general purpose use, it's a bit more complex than C, though.
Neither. Use Java.
[QUOTE=nullsquared;18443209]Neither. Use Java.[/QUOTE] Aren't you a C++ developer?
[QUOTE=nullsquared;18443209]Neither. Use Java.[/QUOTE] *cough* [url]http://www.facepunch.com/showthread.php?t=845849[/url] <- Thread by nullsquared
[QUOTE=nullsquared;18443209]Neither. Use Java.[/QUOTE] :v:
php is obviously the superior language here.
sasquatch
Why are you guys shit posting? Seems like a legit topic.
[QUOTE=DanTehMan;18443245]Aren't you a C++ developer?[/QUOTE] Nope, I <3 Java.
[QUOTE=efeX;18443411]Why are you guys shit posting? Seems like a legit topic.[/QUOTE] sorry i ruined it
There's a thread for this already
[QUOTE=r4nk_;18443346]sasquatch[/QUOTE] What is this?
Malboge is the best. :bandwagon: Depends on what you'll be able to understand easiest honestly. I prefer a mix of C and C++. Realize that right now you're learning a language, not programming. There will come a point where you understand OOP/FP, and you'll merely be learning syntax at that point.
[QUOTE=Chandler;18443837] I prefer a mix of C and C++.[/QUOTE] According to my definition, that's just C++. I consider C++ a superset of C with some unfortunately implemented features (like implicit casts and overloads) If I use C++ features, I am using C++. I do use C++, I am just mindful of shortcomings.
[QUOTE=Cathbadh;18444118]I consider C++ a superset of C[/QUOTE] The best way not to be effective at C++ is to think that way.
[QUOTE=gparent;18444137]The best way not to be effective at C++ is to think that way.[/QUOTE] This.
[QUOTE=nullsquared;18444153]This.[/QUOTE] Stealing from nolyc: Templates, exceptions, namespaces, constructors/destructors (and therefore RAII), virtual function polymorphism, references, operator/function overloading, reusable standard generic containers, and explicitly named casts, is definitely more than just a superset.
[QUOTE=efeX;18443411]Why are you guys shit posting? Seems like a legit topic.[/QUOTE] Seems like a troll.
[QUOTE=gparent;18444173]Templates, exceptions, namespaces, constructors/destructors (and therefore RAII), virtual function polymorphism, references, operator/function overloading, reusable standard generic containers, and explicitly named casts, is definitely more than just a superset.[/QUOTE] There's no such thing as "more than just a superset". You can't make a superset stop being a superset by adding more things to it. However, strictly speaking, C++ is not a superset of C because there are a few things that are allowed in C but not C++. For example: [cpp] #include <stdlib.h> void foo() { int *x = malloc(sizeof(int)); } [/cpp] The return type of malloc() is void*. C has an implicit cast from void* to other pointer types like int*; C++ doesn't. (Not that you'd want to write code like this in C++ anyway. C's syntax carries over into C++, but its idioms do not.)
Don't forget that C++ supports functions with similar names but differing arguments while C does not. (A special case of polymorphism.) The curious and exceptional case (to my dismay, as I hate exceptional cases) is the Unix open() function in C. There's [code]int open(const char *pathname, int flags);[/code] and [code]int open(const char *pathname, int flags, mode_t mode);[/code] both of which are legal in the same context. What the hell, C?
The open() system call is actually a [url=http://en.wikipedia.org/wiki/Variadic_function]variadic function[/url]: that mode_t parameter in the documentation is actually written "..." in the function's declaration in <fcntl.h>, and within the function it's accessed through a va_list, the same way printf() accesses its variable number of parameters. So it's not really an overloaded function like in C++, just abuse of one language feature (variadics) to make up for the lack of another (default values for parameters).
Variadic functions are nothing new, and are kind of a big code security risk. To abuse them like done with open() is kind of dumb.
C is old C++ is new... Any questions?
C++ has everything C has and more.
[QUOTE=Boris-B;18445961]C is old C++ is new... Any questions?[/QUOTE] If you consider 1998 new, then I do have a question.
Sorry, you need to Log In to post a reply to this thread.