Can a function have more than one return value?
Is there a work around?
Maybee in Assembler to return both, R0 & R1.
:-)
Is this silly?
In C ? No.
In C ? Yes. Return a pointer to a structure, or pack several small datatypes into one large datatype, or use global variables. The first is probably the cleanest way to do it, the other two might have their uses in certain situations.
In assembler, all bets are off. As long as the caller (which should also be in assembly) knows what the exit status of the function is (which registers are changes etc), you can do whatever you want in assembly. Just be sure to meticulously document everything, and don't ever call such a function from any language that has particular calling conventions.
View all questions in Keil forum