Why can't the static and register storage classes be used together?

前端 未结 3 465
慢半拍i
慢半拍i 2021-01-14 06:36

When defining a variable in the following manner:

static register int a1 = 0;

we get the error:

error: multiple storage cla         


        
3条回答
  •  南笙
    南笙 (楼主)
    2021-01-14 07:17

    If a compiler implemented what you wanted faithfully then it would tie up a CPU register for the length of your program. That's hardly practical.

    Remember that register is only advisory.

提交回复
热议问题