编译时初始化数组错误 [英] Compile time initialized array error

查看:168
本文介绍了编译时初始化数组错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让一个数组,而我已经在MIPS编译时提供的数据。但我得到的错误,因此,code未得到编译。这里是code这是造成错误的块。

I am trying to make an array to which I have provided the data at compile time in MIPS. but I am getting error and thus the code is not getting compiled. Here is the chunk of code which is causing error.

.data

array: .space 'A','B','C','D','E','F','G','H','I'

什么是错误的原因是什么?如果你知道那解释。空间 .BYTE 的阵列的任何教程和 .word ,请注明他们的答案。

What is the reason for error? If you know any tutorials which explain arrays of .space, .byte and .word, please mention them in answer.

问候

推荐答案

您不能使用。空间指令来初始化数组。 。空间是保留ñ未初始化的字节。您可以使用 .BYTE .word 此目的,具体取决于数据的大小。在你的榜样,你使用的ASCII字符,所以 .BYTE 应该没问题。

You can't use .space directive for initialized arrays. .space is for reserving N uninitialized bytes. You can use .byte or .word for such purpose, depending on the size of your data. In your example, you're using ASCII characters, so .byte should be OK.

.data

array: 
.byte 'A','B','C','D','E','F','G','H','I'

任何MIPS集引用应该没问题。这里是 之一。

这篇关于编译时初始化数组错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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