Does anybody have any insight into the efficiency gains or losses of using the Keil C51 bit type as a return value in a function?
Relavent manual page is here: http://www.keil.com/support/man/docs/c51/c51_le_funcretvals.htm
I hadn't really realized it was a possibility until today, and I see that it's implemented by using the Carry flag, which is neat. I've been trying to think of instances where it might result in undesirable behavior, or would be less efficient for some reason, but I think it seems pretty safe and marginally faster for functions that need only return a boolean.
Does anybody have any opinions for or against making use of it freely in 8051 C?
Barring, clearly, where it's prohibited by the compiler: http://www.keil.com/support/man/docs/c51/c51_le_bit.htm
I hadn't seen a previous post where this was discussed regarding recommended practices, so I thought I'd put out feelers into the collective.
Dan
Definitely impacts portability, I think that's worth getting down in print, I'm pretty sure no ANSI C systems support bit function returns. But there's so much odd C code for 8051 systems, often idiosyncratic seeming because the programs are custom optimized by just these kinds of intuited understandings of what the tradeoffs are in the hardware and in the compiler for certain choices of phrase.
I haven't yet done my own compilation tests (though I plan to later regardless of what anyone posts), but in the meantime I just wondered if anybody else had any strong already-formed (and possibly hard-won) opinions on this topic that would be worth sharing on the forum...