delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/04/23/10:15:20

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Anthony" <akantsel AT integra DOT rmt DOT ru>
Newsgroups: comp.os.msdos.djgpp
Subject: Inline functions question
Date: Fri, 23 Apr 2004 18:08:41 +0400
Organization: Radio-MSU NOC, Moscow State University
Lines: 45
Message-ID: <c6b824$2ks9$1@alpha2.radio-msu.net>
NNTP-Posting-Host: integra.rmt.ru
X-Trace: alpha2.radio-msu.net 1082729348 86921 81.13.30.150 (23 Apr 2004 14:09:08 GMT)
X-Complaints-To: usenet AT radio-msu DOT net
NNTP-Posting-Date: Fri, 23 Apr 2004 14:09:08 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello,

Why does this code

#include <iostream>

class A {
    public:
    void f1();
    inline void f2(const char* str);
};

inline void A::f2(const char *str)
{
    std::cout << "\n __func__ = " << __func__
            << "\n __PRETTY_FUNCTION__ = " << __PRETTY_FUNCTION__
            << "\n Caller = " << str;
}

void A::f1()
{
    std::cout << "\n Now f1() will call f2().";
    f2(__func__);
}

int main()
{
    A a;
    a.f1();
}

produces this:

Now f1() will call f2().
__func__ = f2        <---- I expected f1
__PRETTY_FUNCTION__ = void A::f2(const char*)        <---- I expected
A::f2(...)
Caller = f1

The f2() is supposed to be implanted in f1(), no?
Thanks.
Anthony.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019