Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uflorida!haven!umd5!crabcake!zhu From: zhu@crabcake.cs.jhu.edu (Benjamin Zhu) Newsgroups: comp.lang.c++ Subject: Re: Inline style question Message-ID: <1202@crabcake> Date: 9 Apr 90 02:04:11 GMT References: <154@dumbcat.UUCP> <156@dumbcat.UUCP> Reply-To: zhu@crabcake.cs.jhu.edu (Benjamin Zhu) Followup-To: misc.test Organization: Johns Hopkins University CS Dept. Lines: 50 In article cimshop!davidm@uunet.UU.NET (David S. Masterson) writes: >In article <156@dumbcat.UUCP> marc@dumbcat.UUCP (Marco S Hyman) writes: > > Inlines must be declared as such before they are used. The declaration > can be part of a definition. This puts the programmer in the position of > either declaring inlines within the class body or ensuring the functions > are in a certain order. > >I know I'm gonna get hit about this, but... > >What's wrong with: > >class alpha { > ... >public: > ... > int beta(); >}; >... >inline int beta() { ... } ^^^^^^^^^^^^^^^^^ Forgive my stupidity, but what does this mean? You claim that using this inlining function beta can help you get around the problem (my guess). However, within class alpha's declaration, beta is a member function; whereas in your inline part, it becomes a function of file scope. Of course they are different. On the other hand, if this is a kludge to help you get around the language restraint (say inlines functions have to be declared within the class declaration), what can I say? I prefer not to have magic like this. I do not have the original posting with me. So I should stop flaming around. But frankly, inline functions in C++ are a little bit mysterious. Sigh. > >You can then (potentially) do all your class declarations before doing any >inline definitions and finally the rest of the definitions. Well? > >-- >=================================================================== >David Masterson Consilium, Inc. >uunet!cimshop!davidm Mt. View, CA 94043 >=================================================================== >"If someone thinks they know what I said, then I didn't say it!" Benjamin Zhu zhu@cs.jhu.edu ==================================================================== Sorry, but I have no disclaimer for you ====================================================================