Alex Rivera | Logout

Why cant register variables be made global?

Asked 2010-08-15T08:30:30.803
9

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.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/regdef.htm

Edit
Report

2 Answers

2

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.

answered 2010-08-15T08:33:40.087
-6

Because they're in registers. It's a contradiction in terms.

answered 2010-08-15T08:32:59.247

Your Answer