We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi Keil users. I would like to include a few assembly statements in a C program - to do this I have to compile using the "SRC" directive of Cx51.
This makes me wonder: is there any disadvantage in doing that? Will any C-program compiled and then assembled be identical to one compiled directly to an OBJ file? Perhaps in speed, size is affected - or is it simply an intermediate step that is done explicit instead of implicit?
Cheers Martin Leopold.
"I would like to include a few assembly statements in a C program"
That is generally a bad idea! You are likely to foul up what the compiler's trying to do by inserting bits of "magic" assembler of which it has no knowledge!
If you have something that really needs to be done in assembler, then put it in assembler module and call it from 'C'. That is the safe & sure way.
"Will any C-program compiled and then assembled be identical to one compiled directly to an OBJ file? "
Who knows! Don't even let the issue arise - just keep your 'C' and assembler separate!
"is it simply an intermediate step that is done explicit instead of implicit?"
No, there's more to it than that!
For one, you lose all 'C' source debug info.
See also: http://www.keil.com/forum/docs/thread9964.asp