"Lynn McGuire" wrote:
Is there anyway to force code to be inline other than making that
code a macro ?
Ummm, yes. Put the 100 lines of code into a file called hundred.h
and #include it at all the points in your code where you want to
use it:
// ... a bunch of code ...
#include hundred.h
// ... a bunch more code ...
#include hundred.h
// ... etc. ...
(Note: unlike with normal headers, be sure NOT to use include guards,
because you actually WANT multiple inclusion here. In fact, try to
avoid all preprocessor directives in hundred.h.)
Or, make a multi-line macro:
#define MY_BIG_MACRO \
Blat[0] = Argle[0]; \
Blat[1] = Argle[1]; \
Range = 82 - Domain; \
Slyvern.host(73); \
LastLine = 3.8 * Fargle;
(Notes: don't allow any whitespace after the backslashes, and
don't use a backslash on the last line.)
Or, just make a function, inline or otherwise:
inline double trouble(char actor, int eger) // MIGHT be inline
{
... 100 lines of code ...
return Widget;
}
The function approach is best, even if the inlining fails,
unless you absolutely need to avoid this for some reason
(eg, limited stack space).
If you're doing firmware for a CPU with a tiny RAM, use the
function-like macro or the #included header. Either will
avoid the stack usage inherent to function calls. I've
had to do this at work because the CPU we use for embedded
firmware only has 500 bytes of RAM.
--
Robbie Hatley
Tustin, CA, USA
lonewolfintj atsign pacbell period net
home period pacbell period net slantbar earnur slantbar