Why cant register variables be made global?

后端 未结 9 1442
时光说笑
时光说笑 2021-02-06 13:33

While reading from a site a read that you can not make a global variable of type register.Why is it so? source: http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.js

9条回答
  •  轮回少年
    2021-02-06 14:16

    Originally, register variables were meant to be stored in processor registers, but global variables have to be stored in the data or the BSS section to be accessible from every function. Today, compilers don't interpret the register storage class strictly, so it remains largely for compatibility reasons.

提交回复
热议问题