NXC
Version 1.2.1 r5
|
You can optionally mark NXC functions as inline functions.
This means that each call to the function will create another copy of the function's code. Unless used judiciously, inline functions can lead to excessive code size.
If a function is not marked as inline then an actual NXT subroutine is created and the call to the function in NXC code will result in a subroutine call to the NXT subroutine. The total number of non-inline functions (aka subroutines) and tasks must not exceed 256.
The code example below shows how you can use the inline keyword to make a function emit its code at the point where it is called rather than requiring a subroutine call.
In this case task main will contain 4 PlayTone calls and 4 Wait calls rather than 4 calls to the foo subroutine since it was expanded inline.