Skip navigation.
KDE Developer's Journals

Why C sucks. Part 3473.

lubos lunak's picture

Every now and again you hear someone complaining about C++. You will probably also have heard that C sucks. The two statements are of course linked; the following code is valid C, but will never compile.

a.c:
#include "a.c"

gcc bails out at the 200th recursion with the error message:

In file included from a.c:1,
a.c:1:15: error: #include nested too deeply

I've omitted the two-hundred line long trace back through the other includes.

Update (apparently needed):
Disclaimer: This blog entry on its own doesn't make any sense. If you feel an urge to take it seriously, you probably need to apply your morning coffee.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nicoladinisio's picture

Real power with simple tools

C was conceived in the early 70's for mid-low level programming. Considering the audience it targeted and still targets it is a pretty reasonable language. Real power with simple tools (like in the pre-processor case you cite).
For all the other usages, at the time C was created Algol was already around, then came Pascal, VB and today "managed-code" languages. You have plenty of choices,

pboddie's picture

Only the paranoid

Yes, but only the paranoid would think that the referenced critique of C++ is a swipe against KDE, Qt and various people's manhood, which is how your blog posting appears. I'd guess that a lot of people wouldn't be fully aware of how complex the C++ template system is - there was a well-referenced paper about it and Turing-completeness which did the rounds a while back.

Anyway, C and C++ both suck to varying and endlessly discussable degrees, just like all programming languages. And in a sane world the flame war is suddenly over...

barefooted's picture

LOL

I hope you sent this guy from "Spooky's World" a link to this posting? Laughing out loud

diegocg's picture

The whole #include C thingy

The whole #include C thingy is one of the most ugly C "features" ;(

One of the things I hate (also used in C++) is:

# cat foo.h
#ifndef FOO_H
#define FOO_H
...
#endif

I mean, this is a ugly hack. There're things that could be improved...

cartman's picture

Lol

This is the best reply to that post Eye-wink

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.