this post was submitted on 30 Dec 2024
521 points (98.5% liked)
Programmer Humor
19880 readers
152 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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
ornullptr
as variable names, which will help if you want to copy-paste some well-tested code into a different project later.Isn't
auto
a keyword in C?It means something else.