Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!amdahl!dgcad!gary From: gary@dgcad.SV.DG.COM (Gary Bridgewater) Newsgroups: comp.lang.c++ Subject: Re: Request for C++ coding "guidelines" Keywords: C++, inlines Message-ID: <1345@proa.SV.DG.COM> Date: 10 Feb 90 09:26:04 GMT References: <2754@arran.tcom.stc.co.uk> <25D0B18E.27508@paris.ics.uci.edu> <4446@pegasus.ATT.COM> Reply-To: gary@proa.SV.DG.COM () Organization: Data General SDD, Sunnyvale, CA Lines: 41 In article <4446@pegasus.ATT.COM> hansen@pegasus.ATT.COM (Tony L. Hansen) writes: >< Regarding the extent to which inline functions should be used, I believe >< that there have been numerous comments here lately pointing out that the >< use of inline functions should be highly restricted. Some radicals among >< us (Who, me?) may say that inline functions should never be used. I am >< reminded of the ending of the movie 2010. If you don't like "inline" don't use it. If you don't want to see it, get a magic marker and 'remove' it from your manual. Making a religious issue out of it is counterproductive. Can "inline" be abused? Of course, but if that were an argument c would have died out long ago. Is it possible that there are c++ programmers, perhaps visitors from strange other languages, who know when/how to use inline? Yes. Even the c++ implementation? Maybe. >I think that the comments lately have been pointing out problems with some >current implementations of inline functions: > > When the inline must be outlined, a static version will be created > as needed in EVERY .o file where it is needed. When the .o's are > combined, you suddenly have N occurrences of the static function > which wastes considerable space. Whoops. Who said people that use "inline" care about wasted space? People who want inline want locality of reference and/or tight code. Not because its sexy, but because they need it. Let's just say that, in some instances, it can be very useful to reduce page faults as much as possible and having code purposely spread over multiple pages is anti-useful. What you go on to describe is something different but also useful. What you want is the "outline" statement. It's description would be "inline if possible to save code, else gather all references together to, again, conserve code". This is worth discussing further. Possible use - during debugging a piece of code that is readily inline-able has additional debugging statements #ifdef'd in. Since debugging is a fairly memory intensive activity anyway, conserving code via your scatter/gather compilation methods could be useful. -- Gary Bridgewater, Data General Corporation, Sunnyvale California gary@sv.dg.com or {amdahl,aeras,amdcad}!dgcad!gary The impossible we understand right away - the obvious takes a little longer.