On Nov 13, 2007 2:49 PM, Ken Pizzini <tz_@explicate.org> wrote:
On Tue, Nov 13, 2007 at 09:46:13AM -0500, Arthur David Olson wrote:
My own use of "register" isn't to provide compilers with hints but rather to avoid unintended calls by reference;
Is it possible to make "unintended calls by reference", without at least a stern warning from the compiler (if not an outright error) in the world of prototyped function calls? Passing a pointer-to-T is quite different from passing a value of type T, after all.
To pass by reference, you have to apply the 'address-of' operator to the variable: &variable. The register storage class prevents you applying & to a variable. But you're correct: except in the weird world of the void pointer (and pointer to void pointer, etc), with prototypes in force, you can't pass variable where &variable is correct (or vice versa), so forgetting to apply the & would be an error spotted by the compiler. -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2007.0914 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused."