Editing BoostC Inline Functions
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
Inline functions are statements that look like functions but do not really call anyting or return, the code is generated right "inline" with the statements before and after the "function call". There are a couple of different ways to do this, and a couple of different reasons to do it. | Inline functions are statements that look like functions but do not really call anyting or return, the code is generated right "inline" with the statements before and after the "function call". There are a couple of different ways to do this, and a couple of different reasons to do it. | ||
− | == Ways | + | == Ways == |
− | *Using a # | + | *Using a #DEFINE |
− | + | *Using a inline qualifier in the function definition. | |
− | *Using a inline qualifier in the function definition | ||
− | |||
− | == Reasons | + | == Reasons == |
*Smaller faster code -- sometimes, sometimes not. ( the first time it is used, your save the code for subroutine linkage, the second time you call you have two copies of the function ) | *Smaller faster code -- sometimes, sometimes not. ( the first time it is used, your save the code for subroutine linkage, the second time you call you have two copies of the function ) | ||
Line 20: | Line 18: | ||
Because there are actually two different versions of the function. | Because there are actually two different versions of the function. | ||
− | == # | + | == #DEFINE Details == |
− | all of a #define must | + | all of a #define must b e contained on one line, but a function typically requires several lines. The lines can be simulated by the required ";" the end of statement marker, but you can still run out of line length. You can combine different lines by using the line xxxx characer "\" at the end of a line. This lets you change: |
− | + | ||
to | to | ||
− | + | ||
− | |||
− | |||
− | |||
Line 39: | Line 34: | ||
--- all this needs to be completed and verified in boostc | --- all this needs to be completed and verified in boostc | ||
− | + | == Inline Details == | |
− | |||
− | |||
− | |||
− | |||
− | == Inline | ||
For this method you qualify the function with the keyword inline. According to the manual you can do anything you would with any other function. Perhaps. | For this method you qualify the function with the keyword inline. According to the manual you can do anything you would with any other function. Perhaps. | ||
Line 56: | Line 46: | ||
Cons: | Cons: | ||
− | *You can not debug ( source code ) into the function | + | *You can not debug ( source code ) into the function. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Source Code Using Inline Functions == | == Source Code Using Inline Functions == | ||
Line 71: | Line 54: | ||
== Links == | == Links == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:BoostC]][[Category:PIC]] | [[Category:BoostC]][[Category:PIC]] |