Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #13484

Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour.

From "MikeWhy" <boat042-nospam@yahoo.com>
Newsgroups comp.lang.c++
Subject Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour.
Date 2012-01-18 13:08 -0600
Organization A noiseless patient Spider
Message-ID <jf75be$8sp$1@dont-email.me> (permalink)
References <c72dnSYot-_4l4_SnZ2dnUVZ8o-dnZ2d@giganews.com><tfydnWenHpz4z4nSnZ2dnUVZ8hidnZ2d@giganews.com><jf1onk$1g4$1@adenine.netfront.net><Ze6dneM27chs94nSnZ2dnUVZ8sednZ2d@giganews.com><jf1t1e$538$1@adenine.netfront.net><iZudnd3HOcZeFInSnZ2dnUVZ8sudnZ2d@giganews.com><jf22hj$8np$1@adenine.netfront.net><8YydncgNDvB9DInSnZ2dnUVZ8oGdnZ2d@giganews.com><jf2b8u$f22$1@adenine.netfront.net><bqGdnd40oMTSKInSnZ2dnUVZ7tKdnZ2d@giganews.com><jf2d0e$g8u$1@adenine.netfront.net><z4OdncoNKKISJInSnZ2dnUVZ8lednZ2d@giganews.com><jf3pau$1o2p$1@adenine.netfront.net><v8-dnR1CXMkqHIjSnZ2dnUVZ8l-dnZ2d@giganews.com><576cf8d7-4881-4508-8862-876f5c430a10@k8g2000yqk.googlegroups.com><S6udnZal0s2qFojSnZ2dnUVZ8uCdnZ2d@giganews.com><c80e1e14-f27a-4b7a-946f-c91d8ddf6832@e8g2000yqd.googlegroups.com><jf4815$26d6$1@adenine.netfront.net><25e78f15-9c45-4464-a690-0f31d867deef@b23g2000yqn.googlegroups.com><jf4bfv$k2b$1@dont-email.me> <87fwfdikio.fsf@gmail.com>

Show all headers | View raw


"Gareth Owen" <gwowen@gmail.com> wrote in message 
news:87fwfdikio.fsf@gmail.com...
> "MikeWhy" <boat042-nospam@yahoo.com> writes:
>
>> Arguably, then, the PVF with implementation is not really useful, but
>> simply serves as an escape for defining a benign default action during
>> construction.
>
> With the irony being, as Leigh initially pointed out, this is the one
> thing you're not allowed to do...

I'm a bit vexed this moment. At one point, some earlier version of the 
following did manage to print "AbstractBase::PureVirtual()." Toggling the 
#if now produces no difference. PVF termination is hit, whether the PVF has 
an implementation or not.


#include <iostream>
//======================================================
//======================================================
class AbstractBase
{
public:
    AbstractBase() { foo(); }
    virtual ~AbstractBase() {}

    void foo() { PureVirtual(); }
private:
    virtual void PureVirtual() = 0;
};
//======================================================
// not so pure
//##########
#if 1
//##########
void AbstractBase::PureVirtual()
{   std::cout << "AbstractBase::PureVirtual().\n";
}
//##########
#endif
//##########
//======================================================
//======================================================
class Derived : public AbstractBase
{
public:
    Derived() { }
private:
    void PureVirtual()
    {   std::cout << "Derived::PureVirtual().\n";
    }
};

//======================================================
//======================================================
//======================================================

int main(int argc, char **argv)
{
    Derived a;
    a.foo();

    std::cout << "Hello, world!" << std::endl;

    return 0;
}

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-14 23:06 +0000
  Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Goran <goran.pusic@gmail.com> - 2012-01-14 22:21 -0800
  Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "MikeWhy" <boat042-nospam@yahoo.com> - 2012-01-15 02:25 -0600
    Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-15 14:07 +0000
      Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "MikeWhy" <boat042-nospam@yahoo.com> - 2012-01-15 13:13 -0600
  Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-15 09:29 +0100
    Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-15 14:16 +0000
      Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-15 15:25 +0100
        Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-15 14:30 +0000
  Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. gwowen <gwowen@gmail.com> - 2012-01-16 01:57 -0800
    Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-16 11:28 +0100
      Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 11:29 +0000
      Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. gwowen <gwowen@gmail.com> - 2012-01-16 03:21 -0800
  Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-16 12:04 +0000
    Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 12:52 +0000
      Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-16 14:14 +0000
        Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 14:26 +0000
          Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-16 16:14 +0000
            Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 16:37 +0000
              Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-16 18:02 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 18:22 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-16 19:15 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 20:34 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 20:41 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-16 20:49 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 21:08 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 21:11 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-16 23:18 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 23:39 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-16 23:48 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-16 23:57 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-17 12:24 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-17 14:11 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. gwowen <gwowen@gmail.com> - 2012-01-17 06:43 -0800
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-17 14:52 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. gwowen <gwowen@gmail.com> - 2012-01-17 07:22 -0800
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-17 16:35 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-17 16:40 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-17 17:30 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-18 10:38 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-18 11:57 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-18 12:49 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. gwowen <gwowen@gmail.com> - 2012-01-17 08:59 -0800
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-17 17:03 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "MikeWhy" <boat042-nospam@yahoo.com> - 2012-01-17 11:34 -0600
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "MikeWhy" <boat042-nospam@yahoo.com> - 2012-01-17 12:14 -0600
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Gareth Owen <gwowen@gmail.com> - 2012-01-18 06:37 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "MikeWhy" <boat042-nospam@yahoo.com> - 2012-01-18 13:08 -0600
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "MikeWhy" <boat042-nospam@yahoo.com> - 2012-01-18 13:14 -0600
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-17 15:50 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-17 15:59 +0000
                Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-17 16:09 +0000
          Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. jgk@panix.com (Joe keane) - 2012-01-17 16:13 +0000
            Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. scott@slp53.sl.home (Scott Lurndal) - 2012-01-18 18:11 +0000
        Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. gwowen <gwowen@gmail.com> - 2012-01-16 06:34 -0800
  Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Gil <vnicula@gmail.com> - 2012-01-16 20:55 -0800
  Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-17 17:58 +0000
    Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. scott@slp53.sl.home (Scott Lurndal) - 2012-01-18 18:12 +0000
      Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Leigh Johnston <leigh@i42.co.uk> - 2012-01-18 19:00 +0000
        Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-18 22:00 +0000
      Re: Rationale for base class pure virtual function call from ctor/dtor being undefined behaviour. Gareth Owen <gwowen@gmail.com> - 2012-01-19 06:22 +0000

csiph-web