469,621 Members | 1,822 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

ISO/IEC 14882 3.2 #2 A virtual member function is used if it is not pure.

This is under the heading of "One Definition Rule" in the Standard, in a
paragraph explaining what it means for an object or non-overloaded function
to be 'used': "A virtual member function is used if it is not pure."

The subsequent paragraph says this:

"Every program shall contain exactly one definition of every non-inline
function or object that is used in that program; no diagnostic required."

Is that saying that a virtual member function must either be pure, or be
fully defined if a declaration for it appears in the translation unit,
regardless of whether it is actually called?

I believe the relevant wording is unchanged from this version:
http://www.kuzbass.ru:8086/docs/isocpp/basic.html

--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Dec 7 '06 #1
2 1228
Steven T. Hatton wrote:
This is under the heading of "One Definition Rule" in the Standard,
in a paragraph explaining what it means for an object or
non-overloaded function to be 'used': "A virtual member function is
used if it is not pure."

The subsequent paragraph says this:

"Every program shall contain exactly one definition of every
non-inline function or object that is used in that program; no
diagnostic required."

Is that saying that a virtual member function must either be pure, or
be fully defined if a declaration for it appears in the translation
unit, regardless of whether it is actually called?

I believe the relevant wording is unchanged from this version:
http://www.kuzbass.ru:8086/docs/isocpp/basic.html
I think you can also find the "a virtual function shall be defined or
declared pure or both" somewhere in the document as well.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Dec 7 '06 #2
On Thu, 07 Dec 2006 16:37:39 -0500 in comp.lang.c++, "Steven T. Hatton"
<ch********@germania.supwrote,
>Is that saying that a virtual member function must either be pure, or be
fully defined if a declaration for it appears in the translation unit,
regardless of whether it is actually called?
Yes. By way of illustration, in some typical implementation a virtual
function that is not defined will result in a unresolved entry in the
vtable whether or not that vtable entry is ever used.

Dec 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by santosh | last post: by
2 posts views Thread by Heinz Ketchup | last post: by
14 posts views Thread by v4vijayakumar | last post: by
7 posts views Thread by v4vijayakumar | last post: by
7 posts views Thread by sam_cit | last post: by
13 posts views Thread by Mike -- Email Ignored | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.