2 ms·
> Can someone please elaborate why it is bad? Are their any good resources to fill gaps in my knowledge? If you're actually learning C and writing programs in
by flukus 8y ago
> Can someone please elaborate why it is bad? Are their any good resources to fill gaps in my knowledge?
If you're actually learning C and writing programs in it then the two best things to do would be turn compiler warnings up to 11 and run valgrind often. So you want -Wall and -Wpedantic when you compile and if possible run with valgrind as part of your build script or run it with your tests, just run it often (the longer between runs the harder it is to track back to which change you made).
- saagarjha 8y agoOr -fsanitize=address, if your OS does not support Valgrind.
- aaronmdjones 8y agoNote that you forgot '-Wextra', but even `gcc -Wall -Wextra -Wpedantic` doesn't enable all diagnostics (there are some 40 additional arguments to provide, depending on GCC version); so what you really want is a recent version of Clang and '-Weverything'.