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.2 required=5.0 tests=BAYES_00,HEADER_SPAM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-17 08:30:54 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!xmission!news-out.spamkiller.net!propagator2-maxim!news-in-maxim.spamkiller.net!usc.edu!rpi!not-for-mail From: brangdon@cix.co.uk (Dave Harris) Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 17 Jun 2003 11:33:05 -0400 Organization: unknown Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: Reply-To: brangdon@cix.co.uk NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Tue, 17 Jun 2003 08:59 +0100 (BST) X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPu80rUHMCo9UcraBAQGa8wH/d1fpZnK/I6+8iVCvmABF/BwoSIUl5DYW HP+7GLFsnpyvpQ+vWy6XLflvc+O4xnQrr+68UU7KQDvKsiKZ5hQ25w== =vyPe Xref: archiver1.google.com comp.lang.ada:39342 comp.lang.c++.moderated:68533 Date: 2003-06-17T11:33:05-04:00 List-Id: kanze@gabi-soft.fr () wrote (abridged): > But if operator>>( MyStream&, int& ) is in another translation > unit, how can the compiler know this? Was this question not answered by the very next paragraph you quote: > > The compiler could figure this out either from the source (eg if > > stream is from a template) or from knowing the semantics of the > > std library (if stream is from the std). If the function definition isn't available (eg not inline or a template) and not part of the standard, then of course the compiler can't do the optimisation. (Often that will mean the benefit of the optimisation would be swamped by procedural call costs anyway.) -- Dave Harris, Nottingham, UK [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]