Article View: comp.std.c++
Article #3637extern inlines
From: Scott Meyers
Date: Mon, 11 Mar 1996 00:39
Date: Mon, 11 Mar 1996 00:39
35 lines
2137 bytes
2137 bytes
I'm a little confused about the meaning of extern inline functions.
DWP 7.1.1.4 makes it clear that extern inline functions have external
linkage, so I have two questions.
1. Suppose this definition occurs in header1.h:
extern inline f() { cout << "Hello."; }
Further suppose that header1.h is #included by file1.cpp, file2.cpp, and
file3.cpp and that, for whatever reason, f is NOT inlined. Which object
file will contain the definition of f? My understanding is that only
one of them will.
2. Now suppose there is a second header file header2.h, which contains
this definition:
extern inline f() { cout << "Goodbye."; } // note that this is
// not the same as f above
If I link together an object file containing the definition of f
from header1.h and another object file containing the definition of
f from header2.h, am I correct in assuming that the resulting
program violates the one definition rule and that this violation
need not be diagnosed?
Thanks,
Scott
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Technical Details
Message-ID:
<smeyersDo1L8o.99t@netcom.com>Path:
arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austernShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern From: smeyers@netcom.com (Scott Meyers) Newsgroups: comp.std.c++ Subject: extern inlines Date: 10 Mar 1996 16:39:20 PST Organization: NETCOM On-line Communication Services (408 261-4700 guest) Approved: austern@isolde.mti.sgi.com Message-ID: <smeyersDo1L8o.99t@netcom.com> NNTP-Posting-Host: isolde.mti.sgi.com X-Original-Date: Sun, 10 Mar 1996 08:07:36 GMT Apparently-To: comp-std-c++@uunet.uu.net X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBMUN2Q0y4NqrwXLNJAQECPgIAylje5jPdZdWNBRjQyTJvBkYlr2dZYbBR CtGS0+n1RZOTGFomuyIly6ss70HMbJAZAqIceyyxOgSMo3UkxfzUww== =17uF Originator: austern@isolde.mti.sgi.com