本文介绍了如何取消便携是汇编语言,/真的/?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,写在装配任何东西,或添加组件的任何程序损害了其便携性。但是,怎么不好?我的意思是,基本上所有的PC都是x86或x64这些日子,对吧?所以,如果我嵌入汇编成C程序,为什么不它仍然编译不管它在哪里去了?

I understand that writing anything in assembly, or adding assembly to any program harms its portability. But, how bad? I mean, basically all PC's are x86 or x64 these days, right? So, if I embed assembly into a C program, why wouldn't it still compile no matter where it went?

难道非便携性这个概念仅仅是指当你的真正的挖向特定处理器的特殊怪癖,挤出的每一滴性能,从一张code?

Does this notion of un-portability just refer to when you really dig in to the specific quirks of a specific processor, to squeeze out every drop of performance from a piece of code?

PC游戏过山车大亨写几乎完全用汇编语言,如果我没记错的话。所以......如何取消可移植性难道真的?

The PC game "Roller Coaster Tycoon" was written almost entirely in assembly language if I remember correctly. So... How un-portably could it really be?

推荐答案

除了处理器本身,还有,当然,总是其他方面的考虑:什么是你的目标平台上调用约定?如何为结构传递给其他的(例如:API)值的功能呢?哪些寄存器可以由被调用方被破坏的?这些都保证为preserved呼叫者?如何做一个系统调用?什么是内存布局$ P $在过程ppared为您的操作系统启动?

Besides the processor itself, there are, of course, always other considerations: what are the calling conventions on your target platform? How are struct values passed to other (say: API) functions? Which registers may be clobbered by the callee? Which are guaranteed to be preserved for the caller? How to do a system call? What's the memory layout prepared for you by the OS upon process start?

这篇关于如何取消便携是汇编语言,/真的/?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 12:04