Some processors, such as Atmel AVR , have a general-purpose register file, which is also addressed as part of the main memory - see Figure 7-2 in section 7.4 and the paragraph after the number.
Given this, why committee C decided to do
register int ri; int* pi = &ri;
ubiquitously poorly formed, in accordance with note 101 to N1124 section 6.7.1? Wouldn't undefined or implementation-defined behavior make more sense, given that the code above makes sense on at least one processor, and C bends backward to accommodate much more alien (and weaker!) Goals than AVR?
101) An implementation can process any declaration registersimply as a autodeclaration. However, regardless of whether address storage is actually used, the address of any part of an object declared using the storage class specifier registercannot be calculated either explicitly (using the unary operator &, as discussed in 6.5.3.2) or implicitly (by converting the array name to the pointer, as described in 6.3.2.1). Thus, the only statement that can be applied to an array declared using the storage class specifier register sizeof.
register
auto
&
sizeof
, GCC, , . , :
register int ri asm("r15") = 0; int* pi = (int*)0x15; /* pi now aliases ri */ *pi = 42; /* ri is 42 now */ assert(ri == 42);
GCC ? , , - ... ?
C - , , . C , ( , , , , ).
, register , . , ; , , . register C, , , register ( , ), , . , .
AVR , , , ( , , , auto ).
Source: https://habr.com/ru/post/1683303/More articles:Using jQuery and Math.random () to select properties of nested objects - javascriptAre custom CSS properties global for linked CSS documents? - cssVim (window resizing): how easy is it to make windows equally tall for one column? - vimConditional in coroutine based on whether it was called again? - pythonWhy are registers needed (why not just use memory)? - assemblyHow to “refresh” a div without double-clicking? - jsonЗамените все строки, за исключением скобки в vim - vimWhat is the extension in Visual Studio 2017 Disambiguates "bool" versus "std :: function" when passing in lambda? - c ++VersionNumber and VersionString in umbrella header - ioshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1683308/is-it-possible-to-pass-arguments-to-a-task-in-visual-studio-code&usg=ALkJrhiwt4Vc-JFrzQdtSRQIbdN4xfLQnAAll Articles