this post was submitted on 30 Dec 2024
534 points (98.4% liked)

Programmer Humor

19899 readers
1207 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 8 points 1 week ago (1 children)

To be fair, compiling C code with a C++ compiler gets you all the warnings from C++'s strong-typing rules. That's a big bonus for me, even if it only highlights the areas of your C that are likely to become a maintenance hazard - all those void* casts want some documentation about what assumptions make them safe. Clang will compile variable-length arrays in C++, so you might want to switch off that warning since you've probably intended it. Just means that you can't use designated initialisers, since C++ uses constructors for that and there's no C equivalent. I'd be happy describing code that compiles in either situation as "C+".

Also stops anyone using auto, constexpr or nullptr as variable names, which will help if you want to copy-paste some well-tested code into a different project later.

[–] [email protected] 2 points 1 week ago (1 children)
[–] Opisek 3 points 1 week ago

It means something else.