C Programming • C17 baseline, standards-specific features labeled
Compiler Warnings, Tests, and Debugging
Use warnings, assertions, tests, and runtime instrumentation to find defects earlier.
Compiler warnings catch many mistakes before a program runs. Small tests should cover ordinary values, boundary values, and failure cases. Debug builds can also use sanitizers to detect memory errors; instrumentation complements tests rather than proving a program correct.
Example
cc -std=c17 -Wall -Wextra -Wpedantic -g app.c -o app
cc -std=c17 -Wall -Wextra -g -fsanitize=address,undefined app.c -o app-debug
What to expect
The first build enables common warnings and debug symbols. The second asks a compatible compiler to add address and undefined-behavior checks.
Key idea: Keep warning-clean builds and automated tests in the normal development loop.