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

Library function reentrancy?

I'm sure it's written somewhere and I'm not opposed to looking for it. However I have looked and found nothing so I'll ask.

There are a host of "behind the scenes" library functions that perform such magic as right or left shifts of various data types, etc. Even the ubiquitous switch() statement compiles into a special library call (LCALL ?C?CCASE) to do the work. My (probably paranoid) concern is the degree to which these functions may be employed in an interrupt routine.

I'm concluding that since none of my programs crash miserably that it's OK to use any "c" construct in an interrupt routine and that the behind the scenes library functions are designed for reentrancy.

It would just be nice to find that in print somewhere. Thanks for reading & commenting.
Steve C.

Parents
  • Thanks Neil,

    I think library is exactly the term I'm looking for. However, it needs to be stated that there are sort of 2 libraries here.

    1. The ANSI C standard library routines (requiring header files, STDIO.H, etc., functions like printf(), isalpha(), etc.) and
    2. The underlying run time library functions that implement pointer conversions, switch statement logic, integer division, rotates, shifts, etc.

    All of these functions are found in the Keil library files (such as C51S.LIB) but only the published ANSI functions (as listed in the various header files) are really directly user accessible. My concern is with the other "hidden" functions. It's not always clear when and how they will get invoked.

    For example, a switch() statement (my previous example) will invoke CCASE. A statement like "i = 0x8422 << 7" may invoke some helper shift function as well.

    It's widely understood that interrupt routines should contain as little code as possible for performance reasons. I'm concerned about the nature of that code, not the amount.

    Again it would be nice to some some printed assurance regarding this point.

    Thanks for the reply.
    Steve C.

Reply
  • Thanks Neil,

    I think library is exactly the term I'm looking for. However, it needs to be stated that there are sort of 2 libraries here.

    1. The ANSI C standard library routines (requiring header files, STDIO.H, etc., functions like printf(), isalpha(), etc.) and
    2. The underlying run time library functions that implement pointer conversions, switch statement logic, integer division, rotates, shifts, etc.

    All of these functions are found in the Keil library files (such as C51S.LIB) but only the published ANSI functions (as listed in the various header files) are really directly user accessible. My concern is with the other "hidden" functions. It's not always clear when and how they will get invoked.

    For example, a switch() statement (my previous example) will invoke CCASE. A statement like "i = 0x8422 << 7" may invoke some helper shift function as well.

    It's widely understood that interrupt routines should contain as little code as possible for performance reasons. I'm concerned about the nature of that code, not the amount.

    Again it would be nice to some some printed assurance regarding this point.

    Thanks for the reply.
    Steve C.

Children