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

Where are function parameters/return values stored?

Hi,

I'm looking at calling an ASM routine from some C code. I'd like to pass some parameters into the ASM routine, and have it return a value. I don't believe function arguments are passed on the stack, but am not sure of the general mechanism that is used. Any advice?

Thanks

David


Parents
  • So there we have it. Keil C51 treats bit variables are booleans.

    In the thread Andrew referenced (
    http://www.keil.com/forum/docs/thread1315.asp), I offered an opinion regarding what could be considered as the logical progression of C's integer object narrowing rules if one were to view bits as a "native" C integer as opposed to a "non-native" boolean.

    My real intent in that thread was to convey a hint to those who, like myself, reuse code for other 8051 compilers or other MCU compilers that support non-ANSI/ISO extensions. Other vendors that support bit objects can implement bits according to their own interpretation (and they do). With any language extension, bit variables included, I have found it beneficial to use them in an explicit manner and/or macro'ize them so their usage is clear, trying to avoid any possible ambiguity in the event that the code is reused -- just like you might do explicitly for any "formal" integer-to-boolean conversion between standard C data objects.

Reply
  • So there we have it. Keil C51 treats bit variables are booleans.

    In the thread Andrew referenced (
    http://www.keil.com/forum/docs/thread1315.asp), I offered an opinion regarding what could be considered as the logical progression of C's integer object narrowing rules if one were to view bits as a "native" C integer as opposed to a "non-native" boolean.

    My real intent in that thread was to convey a hint to those who, like myself, reuse code for other 8051 compilers or other MCU compilers that support non-ANSI/ISO extensions. Other vendors that support bit objects can implement bits according to their own interpretation (and they do). With any language extension, bit variables included, I have found it beneficial to use them in an explicit manner and/or macro'ize them so their usage is clear, trying to avoid any possible ambiguity in the event that the code is reused -- just like you might do explicitly for any "formal" integer-to-boolean conversion between standard C data objects.

Children
No data