C wankers

why do C and C++ wankers exist?

I'm talking about the C and C++ guys who think EVERYTHING should be written in C or C++ and think it's the end of the world when someone suggests using something else.

I mean... jesus... that's retarded.

C and C++ are great for writing operating systems, device drivers, and other performance critical systems. Also for high-performance games and specific high performance computing that can use C.

but C/C++ is really NOT needed for most GUI applications, anything with rapid development or any non-OS application where you need increased security but can't afford to hire a full-time code auditor. Java, C# for that if you need something powerful... maybe some future language on the Parrot VM?

also, using C for scripting is insane... use Python, Perl, Ruby, TCL, Lua....

the thing that scares me is that most of the most blantant C/C++ cultists are probably the WORST at abusing C... overloaded everything and throwing security out the window.

the only thing we will lose with the loss of C in everything is programmers who understand everything in more low-level stuff... but honestly, two ASM classes in college would probably do more for helping with that.

I love C, but damn... use the right language for the job....

lol @ java being the language for any job :P

lol, you try writing a secure server application in C and have a serious badass like GOBBLES or guys like Aitel or Litchfield electronically sodomize it. I sure as hell couldn't do it without shit getting exploited.

Gary McGraw has stated that, according to studies Cigital Corporation has done, the average Java programmer makes only one fifth of the number of potentially exploitable security bugs in Java as opposed to C- mainly because you either CANNOT make that mistake in Java due to it's built-in security, or because it's very hard and unnatural to make the mistake.

yes, ideally you should have badasses programming for you, but there is a limited supply of badasses and a lot of simply average programmers who have limited security knowledge. stuff like Java and C# improve things by removing a lot of the problems they create...

and even badasses have to refactor legacy code and make it better... look at OpenSSH, there are some brilliant guys writing code for it, but it's based on a older free version of the original SSH before it got forked commerical and it's got crud in it they've had to clean out, and a lot of stuff was exploited in the process...
if writing stuff in Java cuts your potential security bugs down to a fifth of what it would be otherwise, and you're marketing something that has to be secure.... why in the hell would you NOT use Java?

plus, who the hell wants to write a real GUI in C?

I'm no expert but couldn't you avoid the problems (as you mentioned) by makeing the compilers more robust in that they do detect errors especially for nix enivornment. Also someone brought up a great point (seanster I think) that most programmers are usually programming as root so they avoid certain problems that a reguler user would have. TTT

Ocaml or Common LISP? ;)

seriously, Ocaml is super-optimized for a functional language, is on average only 20% slower than C... and is far more safe.

Common LISP is about 1.5 times slower than modern C++ when compiled... the Jax and Daxter games for PS1 and 2 were written in compiled Common LISP with Scheme for scripting... if it can run a modern game it can run a busy server.

of course those are totally to semi obscure languages that conventional companies would have a fit if their developers wrote in, because hiring other developers to maintain it later would be hard...

but if you were making your own product, you would have no problem doing so.

considering how fast C# is, there's no real reason you couldn't impliment a service for Windows in it.

hell, if you were on one hardware platform and didn't expect to change, you could probably write the performance critical parts in ASM and do everything else in a higher level language than C.

let me ask you a question- if you didn't have guys in-house as smart and experienced as Wietse Vienma, DJB, and the core Apache crew making C services, you absolutely had to have a secure daemon/service or you would lose your job (let's say you were writing it for a security product for the sake of argument, since it's not that bad yet in most companies), and your choice was C or another language....

which language would you choose?

the more and more processing power we get, the less and less we need C.

"I'm no expert but couldn't you avoid the problems (as you mentioned) by makeing the compilers more robust in that they do detect errors especially for nix enivornment."

there are two ways to do that as consistently well as a language developed for safety in the first place assuming that language has no exploitable implimentation flaws)-

you can violate the C spec and create a C-ish language like Cyclone that is mostly C but with safety built in that requires minimal porting to work... however, as of right now Cyclone is slower than other languages that are higher-level, so I don't see the point in using it unless you really need to add safety to a lot of legacy C code and can't afford a total rewrite...

you can also add extensive and full bounds-checking, etc. to compilers.... however turning on full bounds checking in gcc slows down programs by a factor of 5 to 10 times. at that point, you don't really have any gains in using C speedwise.

there are things you can do with the compiler that impliment more realistic, more limited but probably good enough protection....

you can use programs like Stackguard and Propolice to protect against stack smashes, programs like FormatGuard to protect against format string bugs, PointerGuard (not yet released) to protect the heap, and combo kernel changes + slight compiler mods for general memory protection systems like PaX for Linux and W^X and PROT_EXEC purity for OBSD....

these slow down C programs from less than 3% to 25%, depending on how many you apply....

they don't protect against all attacks and their protection is theoretically weaker than a language designed with safety in mind since they rely on clever tricks to work to reduce attack possibilities and are kind of add-ons, but within their limitations they cut down the possibility of attack A LOT.
it will be interesting to see how fast the Parrot VM will be...

that sounds like a JIT compiled VM that is specifically designed for fast speed.. it might be the solution for people who Java is too slow for.

C & C++ are more fun because you get to show how good you are.


but would you bet your security or your life on your C program?

I wouldn't.

"the more and more processing power we get, the less and less we need C."

I hate this quote. It's like saying it's ok to write less efficient code becuase we have more processing power. I know what point you're trying to make, but seriously it's a really bad statement.

However I do agree for the most part on some of the points you have brought up.

Rob you mentioned in early post, that you could make a more secure kernal (I think stackguard), I think this is a great ideal especially when your dealing with mission critical resources. For example a firewall (w/ipchains or iptables) could use stackguard for extra protection.

"That would be a good way to get your developers to quit."

only if your developers are weenies ;)

"That is the single most incorrect, evil thing I've ever read on this board. Shame on you. As punishment, you are to write a multithreaded web server in asm that will run on a 386.

Don't come back until you're finished."

mov AX, BX ;)

"I hate this quote. It's like saying it's ok to write less efficient code becuase we have more processing power."

so, do you still write everything in ASM?

C exists because ASM is not portable.

higher level languages exist because C is hard to program in comparison, is very easy to make mistakes in, and is overkill for a lot of tasks.

it's all about tradeoffs....

"but would you bet your security or your life on your C program?"

Lord no, not *my* life. But customers and management can knock themselves out :)

Well, I know why interview questions often involve C. Most people who think that they know C really do not understand memory or pointers.

That being said, try writing an accounting program in C faster than I write one in C#. Then tell me who gets more GPFs. Then we'll write serial port or socket code. Tell me who's is faster. Both have their advantages. It's all about using the right tool for the right job. You could hammer a nail in with a wrench, but why would you?

It's like that CS / CIS thread someone started. CS focuses on theoretical math (calculus, etc); CIS will focus on accounting and statistics. It's all good; they just serve different purposes. C has a purpose, and Java, C#, VB, ASM, COBOL, etc serve different purposes.

Having a language war is to miss the point completely, and some of you missed the clue train a long time ago and have no hope of getting a clue.