Блог пользователя aldol_reaction

Автор aldol_reaction, история, 3 года назад, По-английски

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.

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

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.

»
3 года назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

ahahhaah firstly, i read title like "debug my gcd or die".

»
3 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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

»
9 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

is any offline version for it

»
9 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Great website for debugging visually