Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!uflorida!gatech!bbn!bbn.com!lpringle From: lpringle@bbn.com (Lewis G. Pringle) Newsgroups: comp.lang.c++ Subject: Re: goodbye cpp ??? (macros vs. inline functions) Message-ID: <33500@bbn.COM> Date: 14 Dec 88 01:11:53 GMT References: <6590072@hplsla.HP.COM> <1757@dataio.Data-IO.COM> <3637@pt.cs.cmu.edu> <1304@cod.NOSC.MIL> <3663@pt.cs.cmu.edu> <1309@cod.NOSC.MIL> Sender: news@bbn.COM Reply-To: lpringle@labs-n.bbn.com (Lewis G. Pringle) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 31 It is not quite true that Inlines preserve the semantics of function calls. At least - in cfront 1.2. Here is an example. inline Catch() { return (setjmp (failureHandlers[which++])); // sb !setjmp??? } Fred () { if (Catch()) { DoSomeStuffThatMayCauseFailure (); } else { CleanUp (); } } Here it is really rather important that the inline act as a macro. I may be an unintended feature of the implementation that the above code works. It certainly violates the 'preserve the semantics' criterion bandied about lately. Yet I contest that it is useful to have inlines work the way they do - especially if you are thinking of trashing cpp! Lewis. "OS/2: half an operating system for half a computer." In Real Life: Lewis Gordon Pringle Jr. Electronic Mail: lpringle@labs-n.bbn.com Phone: (617) 873-4433