Other semantics associated with the register keyword

The register keyword is deprecated and largely ignored .

But this small part of his msdn documentation made me think.

The compiler does not accept user requests for register variables; [...] However, any other semantics associated with the register keyword are satisfied .

What is this semantics?

+6
source share
1 answer

For example, in C you cannot take the address of an object declared using the register qualifier.

 void foo(void) { register int a = 42; &a; // constraint violation } 

Another example: you cannot use register in a file scope declaration:

 register int b = 42; // constraint violation int main(void) { } 
+8
source

Source: https://habr.com/ru/post/989624/


All Articles