This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C51: functions returning bit type - efficiency and opinions for or against?

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