Is assembly code cross-platform?

前端 未结 2 937
猫巷女王i
猫巷女王i 2021-01-07 03:47
0x042444FF; /* inc dword ptr [esp+4] */

0x042444FF is the machine code,while inc dword ptr [esp+4] is the assembly code,

2条回答
  •  心在旅途
    2021-01-07 04:39

    Assembly code is not cross platform.

    Usually there is a very direct mapping between machine instructions and assembly instructions so the assembly code depends on the architecture.

    From Wikipedia:

    An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other integrated circuits. It implements a symbolic representation of the binary machine codes and other constants needed to program a particular CPU architecture. This representation is usually defined by the hardware manufacturer, and is based on mnemonics that symbolize processing steps (instructions), processor registers, memory locations, and other language features. An assembly language is thus specific to a certain physical (or virtual) computer architecture. This is in contrast to most high-level languages, which are ideally portable.

提交回复
热议问题