3 ms·
1) Because the compiler gives you a clear reference implementation to test against for correctness and performance. 2) Because after you do this enough times,
by CoolGuySteve 7y ago
1) Because the compiler gives you a clear reference implementation to test against for correctness and performance.
2) Because after you do this enough times, you will learn when to write your own, when not to, and when to spot inefficiencies in the compiler output. The point is to learn, both about how the instructions work and how the compiler works.
3) The C/C++ implementation serves as documentation of intent and is portable across architectures (including future x86-64 architectures). It's fucking atrocious when devs write pure assembly without a C/C++ reference that can replace it. To me, finding random assembly without a code implementation in the project is the ultimate indictment of a hot rod programmer not thinking about the future or future maintainers.