它是欢颜学习汇编语言的? [英] Is it worthwile to learn assembly language?

查看:162
本文介绍了它是欢颜学习汇编语言的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时它仍然值得学习的 ASM ?我知道一点点,但我还没有真正使用它,或者学会了正确的,因为一切我学会汇编做我可以以1/10的时间做喜欢的 C 或<强一些语言> C ++ 。所以,要我真正学习和使用 ASM ?它会做我的好专业?它会增加我的智谋。总之会是让我成为更好的程序员?

Is it still worthwhile to learn ASM? I know a little of it but I haven't really used it or learned it properly because everything i learn to do in assembler I can do in 1/10th the time with some language like C or C++. So should I really learn and use ASM? Will it do me any good professionally? Will it increase my resourcefulness. In short would it make me a better programmer?

请注意:我说的低级汇编例如 FASM NASM 并没有类似的 HLA(高级别汇编)

NOTE: I am talking about low-level assembly like FASM or NASM and not something like HLA (High-Level Assembler).

推荐答案

我从硖欧文的书中学到什么。如果你忽略他(无关)库(公平)的批评,我可以推荐它作为一个很好的介绍语言本身 - 虽然为的真正的你有有趣的东西,以查清的强迫症患者净。

I learned from Kip Irvine's book. If you ignore the (fair) criticisms of his (irrelevant) libraries, I can recommend it as a good introduction to the language itself -- although for the really interesting stuff you have to hunt out obsessives on the net.

我认为这是有益的理解在较低的水平会发生什么。当你研究汇编,您将了解CPU的流水线操作,分支prediction,缓存对齐,SIMD,指令重新排序等。这些知识将帮助你写出更好的高层次code。

I think it's useful to understand what happens at the lower levels. As you research assembler you will learn about cpu pipelining, branch prediction, cache alignment, SIMD, instruction reordering and so on. Knowledge of these will help you write better high-level code.

此外,传统的观点是不要尝试手动优化组装的大部分时间,但我们关于它的编译器的烦恼。当你看到的扭曲的东西,编译器生成的一些例子,你会更好地理解为什么传统的观点认为。

Furthermore, the conventional wisdom is to not try to hand-optimise assembly most of the time but let the compiler worry about it. When you see some examples of the twisted things that compilers generate, you will better understand why the conventional wisdom holds.

例如:的LFSR的旋转,与携带的指令运行速度快,具体情况是这样,它只是作为容易编写汇编程序的版本,因为它是发现编译器是否足够聪明,看着办吧。有时你只是知道的东西的编译器不支持。

Example: LFSRs run fast with the rotate-with-carry instruction, for specific cases like this it's just as easy to write the assembler version as it is to discover whether or not the compiler is smart enough to figure it out. Sometimes you just know something that the compiler doesn't.

这也增加了你的安全性问题的认识 - 写 - 或 - 执行,堆栈溢出等

It also increases you understanding of security issues -- write-or-execute, stack overruns, etc.

当你什么都了解的一些并发问题才变得明显发生在每个指令级。

Some concurrency issues only become apparent when you are aware of what is happening at the per-instruction level.

在调试的时候,如果你不具备完整的源$ C ​​$ C这可能是有用的,有时。

It can be useful sometimes when debugging if you don't have the complete source code.

还有的好奇心值。如何虚函数实现的呢?曾经尝试写DirectX或COM程序汇编?如何获得返回大的结构,并调用函数提供了一个空间,他们或反之亦然?

There's the curiousity value. How are virtual functions implemented anyway? Ever try to write DirectX or COM programs in assembler? How do large structures get returned, does the calling function offer a space for them or vice-versa?

然后有专门汇编语言的图形硬件,虽然着色器语言,几年前来到高层次的,什么都可以让你思考一个问题以不同的方式还是不错的。

Then there are special assembly languages for graphics hardware, although shader languages went high-level a few years ago, anything which lets you think about a problem a different way is good.

这篇关于它是欢颜学习汇编语言的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆