inline汇编能声明数据段吗?why?

xiaoyuanwang 2009-03-17 08:03:32


#include<stdio.h>
#include<stdlib.h>
#include"fun.h"
int main(int argc, char *agrc[])
{

_asm
{
db 'begin'
}
return 0;
}

编译的时候会有错: error C2015: too many characters in constant
error C2400: inline assembler syntax error in 'opcode'; found 'constant'

本孩子刚接触汇编,请各大大们批评
...全文
167 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoyuanwang 2009-03-23
  • 打赏
  • 举报
回复
and there is anthor issue. even though I complie pass this code, I still got exception while running this code.
can you help me with is?
it shows that array out of bound error.
xiaoyuanwang 2009-03-23
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 cnzdgs 的回复:]
Although an __asm block can reference C or C++ data types and objects, it cannot define data objects with MASM directives or operators. Specifically, you cannot use the definition directives DB, DW, DD, DQ, DT, and DF, or the operators DUP or THIS. MASM structures and records are also unavailable. The inline assembler doesn't accept the directives STRUC, RECORD, WIDTH, or MASK.

不过可以这样写…
[/Quote]



well, this solution is pretty good. thanks a lot. BTW, where did you find this information?
cnzdgs 2009-03-17
  • 打赏
  • 举报
回复
Although an __asm block can reference C or C++ data types and objects, it cannot define data objects with MASM directives or operators. Specifically, you cannot use the definition directives DB, DW, DD, DQ, DT, and DF, or the operators DUP or THIS. MASM structures and records are also unavailable. The inline assembler doesn't accept the directives STRUC, RECORD, WIDTH, or MASK.

不过可以这样写:
_emit 'b'
_emit 'e'
_emit 'g'
_emit 'i'
_emit 'n'

21,500

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧