delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/25/11:30:15

From: "Chris Van Extergem" <chris DOT ve AT pandora DOT be>
Newsgroups: comp.os.msdos.djgpp
References: <n6uP6.2496$X03 DOT 195337 AT afrodite DOT telenet-ops DOT be>
Subject: Re: Deriving from class streambuf
Lines: 57
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <1CuP6.2632$X03.206424@afrodite.telenet-ops.be>
Date: Fri, 25 May 2001 15:10:53 GMT
NNTP-Posting-Host: 213.224.14.209
X-Complaints-To: abuse AT pandora DOT be
X-Trace: afrodite.telenet-ops.be 990803453 213.224.14.209 (Fri, 25 May 2001 17:10:53 MET DST)
NNTP-Posting-Date: Fri, 25 May 2001 17:10:53 MET DST
Organization: Telenet Internet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Chris Van Extergem" <chris DOT ve AT pandora DOT be> wrote in message
news:n6uP6.2496$X03 DOT 195337 AT afrodite DOT telenet-ops DOT be...
> I copied some code from a book, it compiles and (kinda) works with VC++
6.0,
> but when I want to compile with DJGPP, I get following error :
>
> winstream.cpp(8) Error: no matching function for call to
> 'streambuf::streambuf(char *&, winstrbuf::{anonymous enum})
>
> on this line :
>
> winstrbuf::winstrbuf(int y,int x,int h,int w,int bx,int
> vis):streambuf(pbuf=new char[bufsize*2],bufsize),curw(y,x,h,w,bx,vis)
>
> I know where the winstrbuf::{anonymous enum} part comes from :
>     enum {bufsize=1024}; in my class declaration, so that's not a problem,
I
> guess
>
> When I look at streambuf.h, I can only find one constructor for streambuf
:
>     streambuf(int flags=0);
>
> When I look at streamb.h (for VC++ 6.0), I find :
>     streambuf();
>     streambuf(char *,int);
>
> So that explains why it compiles in VC++ 6.0
>
> My question (at last, I hear you say :) is this : who is right ? I know M$
> is known for producing the least conforming compiler, but here it seems
the
> author of DJGPP got a bit lazy and left out the second constructor.  Does
> the standard say anything about this ?
> Should I add this constructor myself ? Should I just adjust my code ? If
> yes, how ?

I adjusted the code, so the winstrbuf c'tor calls the default c'tor for
streambuf and I do the allocation of the pbuf in the body of the function.
This seems to work, but I still would like some answers for the other
questions.

Another question, a bit related to this one : when I compile this on VC++
6.0, it compiles OK like I said earlier, but I don't see much output.  What
I see is some windows on the screen, but when the code gets to the point of
inserting something into the winstream object, nothing is 'printed' (well,
that's not entirely true, sometimes something gets printed, but I don't know
yet under wich conditions), yet getting the same program (with above
modifications) running under DJGPP, it displays all the text that it's
supposed to display.
I realise this is really OT here, but does anyone have any ideas ?

TIA,

Chris


- Raw text -


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