MIPS Data Directives

后端 未结 1 635
星月不相逢
星月不相逢 2021-01-15 01:46

I\'m new in MIPS and trying to teach myself using this book. I\'m trying to learn data directive and what are the difference between these three :

list:            


        
1条回答
  •  梦毁少年i
    2021-01-15 02:13

    list:   .word 0:3
    

    Will reserve 3 words and set each to the value 0. This would be similar to:

    int list[3] = {0, 0, 0};
    

    Or

    list:   .space 12
    

    (In which case, the value is implicitly 0).

    The 0 in '0:3' could have very well be any other value. For example:

    list:   .word 'X':3
    # or
    list:   .word 88:3
    

    When the number of elements is missing, it's simply the value of the word

    list:   .word 3
    

    Which is similar to

    int list = 3;
    

    The last one,

    list:   .word
    

    Will likely cause assemblers to complain for the missing operand.

    0 讨论(0)
提交回复
热议问题