c - Address of register variable when it is taken as auto variable -


suppose, if no registers available in cpu, register variable taken auto variable. can apply & operator it?

also, there way check whether variable register storage class stored in cpu or not?

no. can't. standard quite clear on operators allowed applied on register storaged-classed variable regardless of whether actual register used or not:

c11, 6.7.1 storage-class specifiers, p6

a declaration of identifier object storage-class specifier register suggests access object fast possible. extent such suggestions effective implementation-defined. 121

121) implementation may treat register declaration auto declaration. however, whether or not addressable storage used, address of part of object declared storage-class specifier register cannot computed, either explicitly (by use of unary & operator discussed in 6.5.3.2) or implicitly (by converting array name pointer discussed in 6.3.2.1). thus, operators can applied array declared storage-class specifier register sizeof , _alignof.

(emphasis mine)


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -