Why C sucks. Part 3473.

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.

#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.


This is the best reply to that post ;)

By ismail at Sun, 03/05/2006 - 20:45

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

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

By diegocg at Sun, 03/05/2006 - 21:43

I hope you sent this guy from "Spooky's World" a link to this posting? :-D

By Christian Nitschkowski at Sun, 03/05/2006 - 22:28

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...

By Paul Boddie at Sun, 03/05/2006 - 22:41

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,

By nicoladinisio at Mon, 03/06/2006 - 08:45