Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!usc!apple!agate!shelby!csli!poser From: poser@csli.Stanford.EDU (Bill Poser) Newsgroups: comp.lang.c Subject: inlining Keywords: inlining Message-ID: <15972@csli.Stanford.EDU> Date: 23 Oct 90 07:29:02 GMT Organization: Center for the Study of Language and Information, Stanford U. Lines: 22 To my knowledge, there is no way to determine at compile time whether a particular function is actually being in-lined. Is that correct? The discussion of fast string comparison made me think of this. Suppose that we have a macro like Henry Spencer's STREQ: #define STREQ(a,b) (*(a) == *(b) && strcmp((a),(b)) == 0) Insofar as it is true that most comparisons fail on the first character, this should speed things up over a simple call to strcmp. However, that supposes that the call to strcmp is a real function call. If strcmp is inlined, doing the extra comparison of the first characters is likely to slow things down. This suggests that it would be nice to be able to define STREQ differently depending on whether strcmp is inlined, e.g.: #if inlined(strcmp) #define STREQ(a,b) strcmp((a),(b)) #else #define STREQ(a,b) (*(a) == *(b) && strcmp((a),(b)) == 0) #endif Bill Poser