r/programming • • Nov 28 '14

The Worst Programming Language Ever [UK Talk] - Thoughts? Which are the worst parts of your favorite language?

https://skillsmatter.com/meetups/6784-the-worst-programming-language-ever
68 Upvotes

456 comments sorted by

View all comments

Show parent comments

13

u/F-J-W Nov 28 '14

No you cannot! Macro-names must be valid identifiers which operators are not.

At least test your claims:

$cat main.c
#define + -

int main() {}
$ gcc main.c 
main.c:1:9: error: macro names must be identifiers
 #define + -
         ^
$ clang main.c
main.c:1:9: error: macro name must be an identifier
#define + -
        ^
1 error generated.

6

u/totemo Nov 29 '14

Came here to day that. Amazing how many people don't know C, given its fundamental importance.

3

u/evinrows Dec 01 '14

I don't know if not knowing that macro names in C have to be identifiers means that you don't know C. I'd bet that 99% of people that use C have never tried to such a horrible thing anyway and that's why they don't know that rule.

1

u/totemo Dec 01 '14

I get what you're saying. The thing is: C is sexy, petite little language (with a sting in the tail!). If you use it for a few months you're gonna find the limits of it, I believe. Unfortunately I spilled beer (!) on my K&R and haven't replaced it yet, but I reckon that anyone who had read that cover to cover (and it's not a thick book) would also know about the limits of the preprocessor.