I know this isn't a Keil specific question, but I know you guys are smart and that I'll just get a direct non-mocking answer.
Is it legal to take the address of a function argument?
void Bar(unsigned char *Pointer) { // Access data byte via the pointer } int Foo(unsigned char Arg) { Bar(&Foo); // <<<<<< Is this legal? }
I know you cannot take the address of a variable of type register and I think that knowledge is clouding my memory.
Yes, I know you can use & - but I don't like it. Some compilers will also emit a warning if & is used.
And I'm not too fond of code analyzer tools that prefers the address-of operator for function pointers.
Using & with arrays specifically means the address of the full array instead of the address of the first element, so there is a different type involved.
Anyway - lots can be said about function pointers and this is an interesting article: stackoverflow.com/.../why-do-all-these-crazy-function-pointer-definitions-all-work-what-is-really-goi