Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: in-line functions Message-ID: <3100@umcp-cs.UUCP> Date: Fri, 8-Feb-85 22:24:59 EST Article-I.D.: umcp-cs.3100 Posted: Fri Feb 8 22:24:59 1985 Date-Received: Sun, 10-Feb-85 04:05:27 EST Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 29 jss@sjuvax (J. Shapiro) suggests that we consider inline functions, rather than ridiculously complex macros. It's a good idea. MESA has an INLINE keyword which does the obvious thing. One could use ``register'' functions in C to do the same thing. One point (which is obvious when you think about it) is that the function definition must be available to all routines that use it; the straightforward approach of generating no code for a register function breaks the existing scope rules in C. Two solutions come to mind: either put the definition in a header file (which might fail if compilers were allowed to ignore the register keyword when applied to functions), or instead, generate code but expand in-line anyway (that is, for register foo() { return bar(); } generate a true foo function, but just call bar() directly for instances of calls to foo() within the rest of that source file). Unfortunately, this defeats the purpose of register functions if they are to be called from outside that particular source file, and adds extra space if they are not. (One could use "static register foo()" functions, but this seems to be getting ridiculous...) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland