Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!elroy!orion.cf.uci.edu!oberon!nunki.usc.edu!jeenglis From: jeenglis@nunki.usc.edu (Joe English) Newsgroups: comp.lang.c++ Subject: Re: inline & Zortech compiler Message-ID: <3390@nunki.usc.edu> Date: 5 Apr 89 03:30:40 GMT References: <42890@clyde.ATT.COM> <1911@dataio.Data-IO.COM> Reply-To: jeenglis@nunki.usc.edu (Joe English) Distribution: na Organization: University of Southern California, Los Angeles, CA Lines: 26 bright@dataio.Data-IO.COM (Walter Bright) writes: >The compiler will generate a real function call, rather than inline >expanding an inline function, in the following cases: >1. Calling it through a pointer-to-inline-function. >2. If the body of the function contains if, goto, do, for, while or > switch statements. [... other (fairly obvious) reasons] >It's quite difficult to inline expand a switch or loop statement, and the >utility of it is poor, so it's not done. (The purpose of inlining is to >gain speed, and for a loop most of the time is presumably in the loop, not >in the function call.) Not inlining loops and switches makes sense, but why not if statements? Having functions with if's inlined could be useful in a lot of cases, for example, doing a quick check for parameter validity before executing the rest of the code. What are the technical problems with inlining if's? --Joe English jeenglis@nunki.usc.edu