Article View: comp.std.c++
Article #2103Use of nested class inlines
From: Michael Rice
Date: Thu, 28 Sep 1995 21:44
Date: Thu, 28 Sep 1995 21:44
32 lines
1224 bytes
1224 bytes
A short example:
extern "C" int printf(const char*, ...);
struct Y {
struct XX {
Y* ht_;
void z() { (*ht_).f(); }
XX(Y* h) : ht_(h) {}
};
void f() { printf("Yes\n"); }
};
main()
{
Y yv;
Y::XX xv(&yv);
xv.z();
return 0;
}
According to the draft standard, should this program compile?
Some current compilers accept it, others don't. The question is
where should the compiler check the inline function z()? If it is
at the end of class XX, you'll get an error. At the end of Y or at
the call point, no error.
--
-Mike
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<44eue2$pkc@absoft.absoft.com>Path:
arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage From: mpr@absoft.com (Michael Rice) Newsgroups: comp.std.c++ Subject: Use of nested class inlines Date: 28 Sep 1995 21:44:37 GMT Organization: Absoft Corporation Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <44eue2$pkc@absoft.absoft.com> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text Content-Length: 551 X-Lines: 28 Originator: clamage@taumet