delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/19/22:00:21

From: Claus Fischer <cfischer AT tcadcs6 DOT sc DOT intel DOT com>
Newsgroups: comp.os.msdos.djgpp,comp.os.os2.programmer.misc,gnu.gcc.help
Subject: Re: C++ problem -- Over 30 people were unable to help me, can you?!
Date: 19 Jan 1998 10:18:51 -0800
Organization: Intel Corporation
Lines: 41
Message-ID: <j5l67ng499w.fsf@tcadcs6.sc.intel.com>
References: <bWLoegW7sFse-pn2-d679pGp6mnys AT portD23 DOT Generation DOT NET>
<34c01654 DOT 0 AT news DOT cadvision DOT com>
NNTP-Posting-Host: tcadcs6.sc.intel.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Calvin French wrote:
> I understand your problem. I think, basically there are two things you could 
> try. The first I would try (well actually maybe I'd cut right to the second 
> because I'm an impatient little hack) is to call the constructor with 
> File::fstream(), maybe that alternative will do what you want. I've had so 

I encountered a necessity of explicitely calling a constructor some time
ago and looked up why it did not work. The ARM says that for

class A
{
    A() {}
}

class B : A
{
    A::A();
}

or for any other explicit use of a class constructor, a temporary object of
that class is constructed; even something like

class B : A
{
    ((A*) this)->A();
}

would fail for the same reason (ARM section 12.1). My ANSI draft
standard of 1996 is unfortunately not very elaborate on the point of
explicit constuctor calls; it seems that just not mentioning the
ability to explicitely call a constructor bans its usage, and the fact
that the syntax for the explicit constructor call is already used for
type conversions means anytime you do something like the above it will
result in creating a temporary, but not manipulating B.


--------------
Not speaking for Intel.

Claus Fischer

- Raw text -


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