From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3a9b49a9162025eb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-16 13:01:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: Bye-bye Ada ? (Ada95 Wholesale Changes?) Date: Sun, 16 Feb 2003 13:09:36 -0800 Organization: AdaWorks Software Engineering Message-ID: <3E4FFE10.CD0B26A0@adaworks.com> References: <3E3B7BB5.A1A070@adaworks.com> <3NY_9.9226$x63.6255@nwrddc01.gnilink.net> <3E40A07A.CD174746@adaworks.com> <1044457651.769640@master.nyc.kbcfp.com> <3E42A61C.20905@cogeco.ca> <3E432DD4.7F256C85@adaworks.com> <3E43FA31.9873C5AA@adaworks.com> <3E44A869.DDB2352@adaworks.com> <7dr1a.10399$F25.4223@nwrddc02.gnilink.net> <3E4736B8.1A90C349@adaworks.com> <0yH1a.19068$F25.2303@nwrddc02.gnilink.net> Reply-To: richard@adaworks.com NNTP-Posting-Host: 41.b2.70.e1 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 16 Feb 2003 21:01:02 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:34159 Date: 2003-02-16T21:01:02+00:00 List-Id: OK. I realize that there is some difference between C++ practice and what is technically permitted by the language and allowed by some compilers. I also note the advice given by various authors about this kind of thing, many of whom recommend a very conservative approach since not all compilers behave in the same way. And after reading all the postings, it seems to me that the Ada model is still simpler, easier to understand, and more straightforward than the rather confusing set of rules that characterize C++ inline functions. Thanks, Richard Riehle ======================================================== Hyman Rosen wrote: > Richard Riehle wrote: > > 1) Would you care to comment on why this is typical practice. > > Fewer characters to type, of course. Much less thinking involved. > > > 2) Can one declare a function as inline, or must one include > > its full definition when it is made inline? > > The full definition must appear in any translation unit which > calls it. Inline is applied to definitions rather than declarations, > generally; there's not much point to doing otherwise. > > > 3) In Ada, the equivalent of a declaration can be made inline, in > > the specification. I believe, if I am reading Stroustrup correctly, > > and, yes, it seems to be typical practice, any declaration of an > > inline function (as inline) must also be a definition. If that inline > > function is declared anywhere in the source code, it must be a > > full definition. > > You may declare a function to be inline without providing a definition > for it. But any translation unit which uses the function must contain > the definition. (A translation unit is what you get after the preprocessor > has finished doing its work - all the #include files have been merged.) > > This all happens as a consequence of C and C++ never having had a module > or package system that would allow the compiler to seek out a separate > file which holds the definition. It's possible to bolt on that sort of > thing; I believe Sun's C++ compilers have such a feature.