Why do people use C when there's C++ anyway? C is so... unorganised.
Name:
Anonymous2006-10-14 5:52
To each his own.
Some people might have learned C, and never bothered with C++.
Also, there are fanboys.
Also, some stuff, like Ethereal plugins (last I checked) has to be written in plain C.
Happy-kai?
Name:
Anonymous2006-10-14 7:29
Saying C is unorganised when comparing with C++ is risible.
C++ is an unorganised mess (now). C's problem is that it's too low-level. C++ started off as a set of goodies and improvements on C, but it got a bit out of control after a while...
Name:
Anonymous2006-10-14 7:59
>>1
Because C++ is overcomplicated and disgusting for OO, and provides really nothing over C. I'm not the "There's nothing you can do in Python you can't do in C" guy, of course higher level languages are more productive and nicer to work in, but in the case of C++, you get a similarly complex, low-level language without any real advantages other than perhaps namespaces, at the cost of a lot of complexity and a huge set of features you have to remember, unless what you're writing is C++--.
Name:
Anonymous2006-10-14 9:02
>>4
C++ has the speed of C and the OO part, there is absolutely no other language on this planet that can do this right now.
Name:
Anonymous2006-10-14 10:36
>>4
Overcomplicated? How? I'm doing just fine with my multiple inheritance, <vector> and things like that.. not to mention the memory handling more straightforward
Name:
Anonymous2006-10-14 12:00
>>5 C++ has the speed of C and the OO part
Who said you want that done that way?
>>6
Multiple inheritance is fine, but nested templates and the memory management hell is not my idea of fun.
Name:
Anonymous2006-10-14 12:31
Overcomplicated? How?
H-o-l-y shit. Use a dynamic OO language. Any dynamic language. Yeah, we all know they're not as fast, but you're fucking insane if you think C++ isn't overcomplicated.
Hell, if you just HAVE to have it static, try Ocaml. Ocaml's already pretty ugly, but it's many times cleaner than C++, which is really saying something. Or poke a bit at Objective-C, which is a hybrid.
I do. I decide what I want to do and the tools I'll use. No one else does.
| but nested templates and the memory management hell is not my idea of fun.
Pussies fail at managing memory. And what managment? Object o; -> created and automatically destroyed for you.
Name:
Anonymous2006-10-14 13:10
>>9 I do. I decide what I want to do and the tools I'll use. No one else does.
Hint: Use assembly. C++ is making many decisions for you.
And the fact you think memory management is trivial or unnecessary shows you've never written anything over 200 lines of code.
Name:
Anonymous2006-10-14 13:18
>>10
| Use assembly. C++ is making many decisions for you.
Not when you can deduce the assembly code generated by the compiler.
| you've never written anything over 200 lines of code.
No one count lines of code anymore, noob. And YES, memory management is trivial.
Name:
Anonymous2006-10-14 15:15
This thread makes my head hurt.
C++ does have tangible benefits over C, and anyone who says otherwise simply hasn't written any applications of reasonable size. Language-level OO and forms of generic programming are incredible productivity boosts all around, and are, frankly, far safer than C's methods of managing data.
But, even then, to say that it's a clean design is a joke. It's a language where the standard library basically evolved out of "hey, this template stuff is kinda neat and it can all do this." All the way until the specifications for how templates work exploded into a horrible, horrible mess. And don't even get me started on the compiler error messages.
Memory management is easy peasy in C++ right up until you start dealing with references to data, or multiple things referencing something, or objects having to reference ach other. Then you get to make nightmarish messes of handles or have to resort to things like reference counting/garbage collection libraries, which can be a pain to implement and both have their drawbacks. Not to mention it has a tendency of making a mess of C++'s safe data management. While these can be pretty easy to maintain for a single-person project, as soon as you start adding other people to the mix it quickly becomes a nightmarish headache.
There's a reason most of my development these days avoids both C and C++ unless performance intensive code is absolutely mandatory.
Name:
Anonymous2006-10-14 16:54
"High thoughts must have high language" --Aristophanes
Oh, and here's a mind-bender for the few ignorant wankers who still believe GC is evil: GC is necessary for type safety. Why do you think all functional languages have it?
Enjoy your dangling pointer AIDS.
Name:
Anonymous2006-10-15 3:50
| GC is necessary for type safety.
Where are you pulling this shitty quote from? Uranus I guess...
Name:
Anonymous2006-10-15 13:51
>>16
Basically he's stating that if you explicitly deallocate memory and then create another chunk at the same location while references to the original memory block still exist(aka dangling pointers), you've broken safety and created a memory error. "Type safety" isn't quite the correct term here but it is what Wikipedia uses, and that's about as accurate as ever.
GC handily gets around that by not having any explicit deallocation whatsoever, ensuring that all references are valid at all times. Of course, this also causes fragmentation and cache misses as the program ends up allocating new memory like crazy until the GC kicks in.
Read comp.lang.c++.moderated a bit more often, okay? I'm not even a C++ programmer fer fuck's sake!
Name:
Anonymous2006-10-16 19:21
if you do explicit object creation and destruction you don't need a GC to ensure type safety. You're thinking too low level. You can use references like java where it doesn't matter how memory is allocated, a reference to an object is always typesafe.
Name:
Anonymous2006-10-16 20:50
Pah. Stale pointers lead to undefined behaviour, instead of broken type safety. It's true though that allowing memory to be collected exclusively through GC results in never having a pointer to a block that has been reassigned, however the benefits (and indeed the typesafety argument itself) are purely academic.
Name:
Anonymous2006-10-16 22:02
however the benefits (and indeed the typesafety argument itself) are purely academic.
Segfaults are purely academic?
>>22
Your view was widely accepted 20 years ago. Reality has since caught up with academia. Enjoy being mocked by your peers for your outdated views. Loser.
Name:
Anonymous2006-10-17 16:03
>>20
loooooooool, more shitty material from university teachers who never used C++ in the real world...
Name:
Anonymous2006-10-17 16:17
>>26
loooooooool, more shitty replies from highschool students who never used C++ in the real world...
Name:
Anonymous2006-10-17 17:40
After hearing so many horror stories about C++ (and dabbling a bit with the Half-Life code when I was younger), I was pleasantly surprised when I finally got around to learning C++. The more "late" aspects of C++ are actually quite good to work with, and Boost is just awesome =D
>>28
Indeed, most C programmers here are just K&R fanboys that can't accept any authority other than ANSI (lol) because that would make them unamerikan.
Name:
Anonymous2006-10-18 6:04
>>29
I know /prog/ doesn't exactly attract the most intelligent of posters, but you don't need to be _that_ stupid.
>>29
I'm European and I use ISO C99. I'm also a K&R fanboy and want to kill Stroustrup.
Name:
Anonymous2006-10-19 9:28
So in what way could C actually be considered better than C++ these days? It doesnt have a speed issue anymore, and C++ allows for better structure within the code?
Some embedded systems don't have C++ compilers, only C
Name:
Anonymous2006-10-19 14:15
>>37
stdio sucks, I only printf with OpenGL, I'm l33t.
>>38
what are you waiting to write one? sitting on your lazy ass won't help you...
Name:
Anonymous2006-10-19 15:50
>>39
No I'm not wanting to write one. Look at the comment I was replying to, I was explaining where C can be considered better than C++, i.e. where C++ is not available because it's too complicated for the platform being programmed.
Of course, that's not saying much (I, it's C for crying out loud), but there's a reason why reference crypto algorithms are written in C, not C++. It's also why things like splint can exist.
OTOH, not many people need that degree of clarity. What they need is abstraction, which C isn't all that hot at.
Name:
Anonymous2006-10-20 5:42
>>23
Segfaults qualify as undefined behaviour. Wanker.
Analogous arguments that may be more or less true than the above statement:
Python is better than Perl because it's SIMPLER.
Scheme is better than Lisp because it's SIMPLER.
Programs with fewer lines of code than larger programs that do the same thing have less security holes because they're SIMPLER.
You can read the C specification in an hour and understand everything about the language. Sure, it doesn't support every paradigm of programming out there (neither does C++!), but the result is that the idioms are quickly recognizable by other programmers.
C is much easier for static code analysis tools like lint to work with.
More people know C than C++.
C++ has plenty of nice ideas shoehorned onto C (the best of which were added back to C to make C99), but I'll stick with the C's workhorse rather than C++'s sprawling "elegant" object/template/rtti/abstract container classes (all that and you still don't get closures! oops!)
Programs with fewer lines of code than larger programs that do the same thing have less security holes because they're SIMPLER.
IF THEY DO THE SAME THING THEY HAVE THE EXACT SAME SECURITY HOLES YOU IDIOT
1) C and C++ can't do everything; However they can do anything any other language (except asm) can do.
2) C offers very little abstraction, C++ a bit more
3) C++ is more complicated than C.
4) Takes years to learn C. Twice the time to learn C++.
5) Using higher level languages that offer more abstraction allows people to concentrate to real problems rather than trivial ones that have been solved so many times before
6) Learning C or C++ and solving trivial problems for the sake of practice & knowledge is fine; else you're the cancer killing programming.
7) C++ is retarded
>>63
Oh, and 8) i forgot to add
8) C is not faster than C++. There's no speed in languages, only in algorithms and actual code. And assembly. In assembly it's documented how many cpu cycles each mnemonic takes, however in C or C++ or any other language they don't tell you that + is 'faste'r than *.
Name:
Anonymous2007-11-07 23:31
>>63
1. Your definition of "do anything" is wrong.
2. Well yeah.
3. You're getting good.
4. Meh, perhaps.
5. Sure does.
6. I like you.
7. ♥
Name:
Anonymous2007-11-08 0:33
>>64
>There's no speed in languages, only in algorithms and actual code.
C, Java... same shit.
Name:
Anonymous2007-11-08 0:36
>>63 >>64 >>65
Stop trying to find excuses for using toy languages like LISP, just because you're too retarded to work with languages that are closer to the machine.
Don't get me wrong. Guys like you are needed. There will always be people who code in assembler and others who can only do PHP. Just be honest about it and stop lying to yourself.
>>67
You're a troll, i'm sure i know every instruction of the assemblers you've EVER HEARD OF.
SPARC, MIPS, 8086, Z80, PDP11, WHATEVER. BRING IT BITCH
Lisp offers great abstraction, and YOU'RE A MORON BECAUSE C OR C++ ARE NOT CLOSE TO THE MACHINE.
INFACT, THEY HAVE *NO RELATIONSHIP* WITH THE MACHINE.
YOU FUCKING NOOB.
Name:
Anonymous2007-11-08 0:59
>>67
If I want to be close to my machine, I'll unzip and code some assembler. Maybe C. But Sepples? That's for faggots who want to get high level but have an irrational fetish for doing what the computer should do, and who aren't bright enough to understand a real high-level language.
Name:
Anonymous2007-11-08 5:02
>>67
OMG closer to the machine! Hell yeah! Keep wasting your time, faggot ricer.
>>71
No. We take the sane approach by getting stuff that works well ASAP then continually refining it to make it better.
Name:
Anonymous2007-11-08 9:51
>>72
Yes LISPfag, you can't code and need a language that dumbs it down to MBA level. What else is new?
Name:
Anonymous2007-11-08 9:53
>>69 and who aren't bright enough to understand a real high-level language.
The higher the level, the less skill is needed. Also limits what can be done with the language of course, but not like enterprise fags really care.
>>58
Kiss your cellphone goodbye bitch. That and anything made by PLC or CNC or microcontrollers or... or...
There's a lot more use for embedded than enterprise shit.
Name:
Anonymous2007-11-08 12:08
>>73
Lol, this is such an hilarious troll. COBOL and Java are the business language, and MBAs are more likely going to understand C. No chance in hell of them understanding McCarthy's original Lisp, let alone a modern Lisp.
>>74 The higher the level, the less skill is needed.
Big failure. You either think high level = Visual Basic, or are a troll. You need different skills, which are sometimes harder to gain (but yield better and faster results once got, hence you prefer high-level languages).
Also limits what can be done with the language of course, but not like enterprise fags really care.
You're definitely ignorant. You think high-level = Spectrum BASIC. A high level language such as Python has access to the same things an OMG OPTIMIZED C program would, including POSIX (or Win32) and any library you can use from C, and it can even improve it as you can use these functions as first-class functions, introspect them, etc. They can also handle octet buffers and bit masks before you ask, and they support memory mapping, low-level sockets (even though there are much better ways to use them), ioctl, and absolutely everything you would do from C, except __asm { OMG EAX, [ECX*2+OPTIMIZED] } which is not C nor standard anyways.
>>76
If you think LISP is hard, just go kill yourself.
Name:
Anonymous2007-11-08 15:38
Why do people use C when there's C++:
My main reason: Exceptions. I hate exceptions. When you realize that most people using computers are idiots, there can be no exceptions. Failure is a given. I recognize three exceptions, all three of which may not be caught by a compiler:
1. Stack Overflow. Been there, done that, had a program that would cause a stack overflow on Windows XP, but not on Windows 98. And the 98 computer had less RAM.
2. Segmentation Fault. Invalid Page Fault, whatever you want to call it. In a protected mode environment, accessing memory not owned by the program.
3. Integer Division by Zero. Nuff said.
Name:
Anonymous2007-11-08 15:48
>>79 When you realize that most people using computers are idiots,
there can be no exceptions using computers are idiots, there can be no exceptions there can be no exceptions no exceptions
Name:
Anonymous2007-11-08 15:52
>>76
>low-level sockets
Well THERE'S your problem!
Name:
Anonymous2007-11-08 16:42
I recognize three exceptions, all three of which may not be caught by a compiler (...) Integer Division (blah blah blah)
The stupid and moronic examples you gave just show that you do not understand what an exception is.
Name:
Anonymous2007-11-08 16:45
20% des voitures sont responsables de 60% des émissions automobiles. Peugeot s'engage ! C'est chiant la télé :'(
real high level programming means working with more powerful abstractions. If you really think abstractions aren't useful, sure, maybe you better stick with c.
"Why do people use C when there's C++ anyway? C is so... unorganised."
Lol...it's exactly the opposite. C is simple and clean, there's one way to accomplish any task and few exceptions to the rules. A complete and exhaustive description of C fits in the ~100 page kernighan and richie book.
C++ tacks a couple of things onto C that makes it a much a less elegant language IMO.
The bottom line is if you want to do procedural programming use C and if you want to do object oriented programming use java.
Java is a pure OO language and this adds a lot in terms of clarity and consistency of syntax.
That said, both C and C++ are saddled with a couple of anachronicities(gotchas) having to do with the way pointers are handled and which data types are first class that makes them seem much trickier than they really are. Ones you know those the languages are cake.