On Wed, Apr 17, 2002 at 05:48:44PM -0700, Seth Arnold wrote: > On Wed, Apr 17, 2002 at 06:21:28AM -0400, Dan Erickson wrote: > > int x; > > x = 5; > > > > X is just a place in memory that we have named x for human > > readability purposes. Now x (the place in memory we have named x) holds > > the value five. How does it accomplish this?? > > Consider the similar code: > > register int x; > x = 5; > > '5' is stored in the machine, but without a memory location. <nit> Nope. The "register" keyword is only a *hint* to the compiler that you would really like to have it put the variable in a register. The compiler can decide that it's stupid and ignore the hint. On a register starved architecture like ix86, the compiler will most likely ignore the hint simply because the code gets much more efficient when it keeps a more frequently used variable in a register. RISC architectures (MIPS, Sparc, Alpha, ARM, PPC) have more general purpose registers, and the compiler will usually take the hint, but if it has reasons not to do so it will ignore the register keyword. My experience is that modern C compilers don't really need the register keyword, simply because they already put frequently used variables in registers as much as possible. </nit> Erik -- J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty of Information Technology and Systems, Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands Phone: +31-15-2783635 Fax: +31-15-2781843 Email: J.A.K.Mouw@its.tudelft.nl WWW: http://www-ict.its.tudelft.nl/~erik/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/