Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

xdu-icpc/2019-summer-lecture-debug

Repository files navigation

Lecture on Debug, The 2019 Xidian University ICPC Summer Training

This repository contains all material of this lecture. You can clone it and use it under CC-BY 4.0 License.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

Errata

  1. The precision of double was presented "48 bits", which is wrong.
  2. SIGSEGV was misspelled SEGSEGV.
  3. The recent revision of ICPC Final Rule removed the note about stack limit. It's not yet known if it would be limited or unlimited. So the corresponding note in the beamer is marked as deleted. You may wish to test for the stack limit in ICPC Regional Warmups.
  4. One typo in asm_stack.cc makes the stack size 4 or 8 times of expected.

Beamer

The beamer, with all errata fixed can be downloaded here.

Supplementary Material

Program Source Code

They can be found in the code directory.

Assertion

Due to an oversight we forgot to discuss the usage of C assert macro. It's extremely useful to detect logical errors early. It's also a hint to the people reading the code. For example, you can put assert(__gcd(a, M)) == 1 in the BSGS code library to prevent someone (maybe yourself) from misusing it.

Reference

  1. Slide 6: "Testing and debugging consume more than a half of all the time developing a software": See F. P. Brooks, Jr., The Mythical Man-Month: Essays on Software Engineering
  2. Slide 10: "Basketball": See S. Summit, C FAQ Question 11.35
  3. Slide 10: "Undefined Behavior": Some useful articles can be found in my blog.
  4. Slide 13: "Codeforces has 256MB stack": See M. Mirzayanov, About the programming languages
  5. Slide 13: "Unlimited stack of ICPC": See J. Clevenger, 2018 ACM-ICPC World Finals Programming Environment. However this note has been removed in 2019, see Errata 3.
  6. Slide 15: "Ariane 5 crash": See J. L. Lions, et. al., ARIANE 5 Flight 501 Failure
  7. Slide 32: "Shrodinger's precision of double on 32-bit machine": See GCC Bugzilla, PR323
  8. Slide 35-50: The tools are introduced: Andrey Vihrov, Catching silly mistakes with GCC
  9. Slide 58: "BAPC 2018": Homepage, Codeforces Gym
  10. ISO/IEC JTC 1 SC 22 WG 14, Programming Languages - C (Committee Draft N1570)
  11. ISO/IEC JTC 1 SC 22 WG 21, Working Draft, Standard for Programming Language C++ (N4659)