Using Assembly Language in C/C++

前端 未结 14 1290
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 02:39

I remember reading somewhere that to really optimize & speed up certain section of the code, programmers write that section in Assembly language. My questions are -

相关标签:
14条回答
  • 2020-12-23 03:12

    On some embedded devices (phones and PDAs), it's useful because the compilers are not terribly mature, and can generate extremely slow and even incorrect code. I have personally had to work around, or write assembly code to fix, the buggy output of several different compilers for ARM-based embedded platforms.

    0 讨论(0)
  • 2020-12-23 03:15

    First of all, you need to profile your program. Then you optimize the most used paths in C or C++ code. Unless advantages are clear you don't rewrite in assembler. Using assembler makes your code harder to maintain and much less portable - it is not worth it except in very rare situations.

    0 讨论(0)
提交回复
热议问题