Re:Next steps for Rust in the kernel
by tialaramex on Wednesday September 21, 2022 @12:57PM
(#32927958)
C's register keyword is a storage specifier, it actually does do something, what it does is announce "This might not have an address" (your CPU registers don't have addresses) and so you can't make a pointer to it with the unary & address operator.
Your C compiler might conclude - even if it doesn't decide to put the variable in a register - that since the variable notionally doesn't have an address some optimisations are available which it can't otherwise be sure are safe.
Your C compiler might conclude - even if it doesn't decide to put the variable in a register - that since the variable notionally doesn't have an address some optimisations are available which it can't otherwise be sure are safe.