Could you give me a suggestion? I wonder that in competitive programming debugging with gdb will improve efficiency or not? Now I just use IDE such as Dev Cpp, print something for debugging. Is necessary for me to learn gdb and use it in debugging for competitive programming? If you could gvie me advice, I would so grateful.
I'm used to debugging through comments, delete(to find which code has segmentation fault or cause Endless loop), and output(to find if the value is correct). And I think it is enough for algorithm competitions. Breakpoint debugging is too slow. But if you want to learn more debugging skills. You could watch this video from our school.
I think so, after I solve problems in months.Commets are quicker.
ahahhaah firstly, i read title like "debug my gcd or die".
Haaah,it sounds like you are crazy at number theory
I personally use multiple compiler flags which help me cover different runtime errors. It helps in detecting overflows, vector out of bounds ,stack overflow ,divide by zero by giving a better description of issue rather than just segmentation fault.
Compiler flags:
-Wall -Wextra -pedantic -std=c++11 -O2 -Wshadow -Wformat=2 -Wfloat-equal -Wconversion -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover -fstack-protector
Note: Using these compiler flags will make the program run slower during testing.
For more information on debugging : Compilation and Debugging
Thanks, bro. It's useful:) Now I add them to my compiler.
is any offline version for it
Great website for debugging visually