为什么不经常在汇编中编写程序? [关闭] - Why aren't programs written in Assembly more often? [closed]

10/14 10:10
阅读数 0

问题:

It seems to be a mainstream opinion that assembly programming takes longer and is more difficult to program in than a higher level language such as C. Therefore it seems to be recommend or assumed that it is better to write in a higher level language for these reasons and for the reason of better portability. 似乎主流观点认为汇编编程需要更长时间并且比C等更高级别的语言更难编程。因此,似乎建议或假设出于这些原因更好地编写更高级别的语言并且为了更好的便携性。

Recently I've been writing in x86 assembly and it has dawned on me that perhaps these reasons are not really true, except perhaps portability. 最近我一直在写x86汇编,我突然意识到这些原因可能不是真的,除了可移植性。 Perhaps it is more of a matter of familiarity and knowing how to write assembly well. 也许这更多的是熟悉并且知道如何很好地编写装配。 I also noticed that programming in assembly is quite different than programming in an HLL. 我还注意到汇编中的编程与HLL中的编程完全不同。 Perhaps a good and experienced assembly programmer could write programs just as easily and as quickly as an experienced C programmer writing in C. 也许一个优秀且经验丰富的汇编程序员可以像经验丰富的C程序员用C语言一样轻松快速地编写程序。

Perhaps it is because assembly programming is quite different than HLLs, and so requires different thinking, methods and ways, which makes it seem very awkward to program in for the unfamiliar, and so gives it its bad name for writing programs in. 也许是因为汇编程序设计与HLL完全不同,因此需要不同的思维,方法和方法,这使得为不熟悉的程序编程看起来很尴尬,因此给它编写程序的坏名称。

If portability isn't an issue, then really, what would C have over a good assembler such as NASM? 如果可移植性不是问题,那么真的,C会对NASM这样的好汇编程序有什么影响?

Edit: Just to point out. 编辑:只是指出。 When you are writing in assembly, you don't have to write just in instruction codes. 在汇编时编写时,不必只是在指令代码中编写。 You can use macros and procedures and your own conventions to make various abstractions to make programs more modular, more maintainable and easier to read. 您可以使用宏和过程以及您自己的约定来进行各种抽象,以使程序更加模块化,更易于维护和更易于阅读。 This is where being familiar with how to write good assembly comes in. 这是熟悉如何编写良好汇编的地方。


解决方案:

参考一: https://en.stackoom.com/question/BGKC
参考二: https://stackoom.com/question/BGKC
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部