I have encountered some problems while writing the code for 8051 microcontroller, Can you explain me the following issues: 1- Compiler issued an error when i pass the value to function by referece e.g. void function( unsigned char& val);
2- Comiler issued an error when i tried to use the default argment to a function e.g. unsigned char Volume ( char side = 1 );
3- Comiler also issued error when i tried the function overloading method e.g. void function (unsigned char val); void function (unsigned int val);
4- How can i access variables with the same name which are both declerad local and global? Can anyone tell me above mentioned issue with keil comiler.
Regards, Ahmad Kamal Nasir
... a frustrated "PC programmer" trying to make the poor little '51 'behave'.
Sir, as said so often before the '51 ain't no PC
Well, I think you're barking up the wrong tree. The "problems" have nothing to do with '51s or PC, but with trying to feed C++ code to a C compiler.
The "problems" .... trying to feed C++ code to a C compiler
Is that not "trying to make the poor little '51 [tools] 'behave'." ?
Erik
Is that not "trying to make the poor little '51 [tools] 'behave'."
A C (not C++) compiler on the PC (or any other platform) will misbehave the same way when you're trying to use it to compile C++ code.
As Christoph says, it is not necessarily the case.
I don't think that any of the things mentioned would necessarily be particularly bad for a 51.
Of course, the fact that the OP hadn't even realised that there's a difference between C and C++ doesn't bode well for his having thought carefully about effeciency of programming on an 8051...
"A C (not C++) compiler on the PC (or any other platform) will misbehave (sic) the same way when you're trying to use it to compile C++ code."
It's not mis-behaving at all - it is behaving perfectly correctly!
;-)
.... a frustrated "PC programmer" trying to make the poor little '51 'behave'. Sir, as said so often before the '51 ain't no PC
the thing is that ever so often some "PC type" decides that doing the '51 is no different than doing a PC.
The results are, most often (always?) a total mess
how many posts have we not seen about malloc, function pointers etc.
Yes, all is possible, but NOT till you understand the underlying logic which "a 'PC type' doing the '51" does not.
that the OP does not even know that C is not C++ just emphasizes the point.