this post was submitted on 15 Jan 2025
111 points (93.7% liked)
Programming
17831 readers
43 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
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
This is often done for backward compatibility, as stdbool.h which provides true and false wasn't standard before C99 and even though that's more than 25 years ago now a lot of old habits die hard.
Also, plenty of embedded systems don't use the C standard library.
stdbool.h (along with float.h, limits.h, stdarg.h, stddef.h, stdint.h, and some other library facilities) is required to be provided even in freestanding environment so, at least as long as you use an ISO C conformant compiler, you can always include those even if you don’t have a libc implementation
Yeah in the late 90's I was coding in C++ and I'm pretty sure I had to define true and false manually.
I seem to recall using the true and false literals C++ in the late '90s ... looks like they were in the C++98 standard, but it's not clear which pre-standard compilers might have supported them.
Ahh this makes some sense