Post #27302
2025-12-03 10:23 UTC
Reminder: whenever you see examples of 'cursed' C or C++, run it built on GCC/Clang with
-Werror -Wall -Wextra -fsanitize=undefined,address
and see how far it gets. These flags should be enabled by default in IDEs, build systems and for testing and development.
Replies (3)
-
@JSAMcFarlane@mastodon.ie 2025-12-03 10:28
Here's the OP: https://x.com/JSAMcFarlane/status/1501104283487457281 Since then, C++ has started to turn around, but not before I burned out. Those flags are still necessary today.
-
@JSAMcFarlane@mastodon.ie 2025-12-03 10:29
The most recent example is https://www.youtube.com/watch?v=zC_uwGqSLqQ which doesn't share the bug but is likely easy to detect: https://godbolt.org/z/MGMdc3EPc
-
@rollbear@fosstodon.org 2025-12-03 11:25
@JSAMcFarlane@mastodon.ie Indeed! I usually also add -Wpedantic to avoid accidental use of extensions, and -Wconversion to catch expensive (or bug prone) hidden conversions. Not applicable to all code. YMMV.