Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ncar!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: a reasonable approach to inlining Message-ID: <11996@mimsy.UUCP> Date: 16 Jun 88 19:37:37 GMT References: <238@chem.ucsd.EDU> <2742@utastro.UUCP> <225800036@uxe.cso.uiuc.edu> <6667@sigi.Colorado.EDU> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 55 In article <6667@sigi.Colorado.EDU> ziel@spot.Colorado.EDU (ZIEL FRED ADAM) writes: >... Microsoft ... C 5.0 ... "intrinsic" functions. These are standard >library functions such as movmem, strcmp, strcpy, inp, outp, etc. that >are inlined. The instrinisic code generation can be turned on and off >individually for each function using a #pragma. The dpANS provides for inline generation in a different way: For instance, #include... double low; ... low = floor(arg); might generate floor inline, while #include #undef floor ... double low; ... low = floor(arg); will refer to a library routine. Note that this makes it difficult to temporarily refer to the library version; with #pragma one can presumably turn inlining back on later. I do not know whether the dpANS allows a second #include to turn floor back into an inline. >... They also have #pragma's to control the optimizations ... ie. >optimized null delay loops don't serve their purpose if they are >optimized away ... This, incidentally, is yet another reason that either pragmas should not be like `preprocessor' controls, or that `#define' macros should be allowed to expand to such controls. A delay macro like #define DELAY(n) {int delay_tmp = (n); while (delay_tmp--) /*void*/;} should clearly disable optimisation, yet if this is to be done with `#pragma', we need something like #define DELAY(n) { \ int delay_tmp = (n); \ #pragma optimisation: push state \ #pragma optimisation: none \ while (delay_tmp--) /*void*/; \ #pragma optimisation: pop state \ } but by all the rules, these `#pragma's are in the wrong place. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris