🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #462

Problems with InterViews' iostreamb class

#462
From: Johan Garpendahl
Date: Wed, 27 Jan 1993 03:11
137 lines
5107 bytes
I've been trying to compile InterViews RPC classes with g++-2.3.3 and
libg++-2.3. I've been able to compile them but it doesn't work, and I
don't know why.

Anyway, they have some classes iosb, istreamb, ostreamb and iostreamb
that inherits the corresponding classes without the "b".
They redefine all the operators << and >>. (see included #include-file
at end)

The problem is that when an object of class iostreamb (or a class
derived from iostreamb) uses an operator << or >>, the call does
usually not go to the iostreamb version, but to the iostream version.

Now, is this a bug in InterViews, g++ or libg++?
Do you need more information than this to find out?

	Johan

Here is iostreamb.h:
----------------------------------------------------------
/*
 * Copyright (c) 1987, 1988, 1989, 1990, 1991 Stanford University
 * Copyright (c) 1991 Silicon Graphics, Inc.
 *
 * Permission to use, copy, modify, distribute, and sell this software and 
 * its documentation for any purpose is hereby granted without fee, provided
 * that (i) the above copyright notices and this permission notice appear in
 * all copies of the software and related documentation, and (ii) the names of
 * Stanford and Silicon Graphics may not be used in any advertising or
 * publicity relating to the software without the specific, prior written
 * permission of Stanford and Silicon Graphics.
 * 
 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
 *
 * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR
 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
 * OF THIS SOFTWARE.
 */

#ifndef dp_iostreamb_h
#define dp_iostreamb_h

#include <Dispatch/enter-scope.h>
#include <iostream.h>

// Modify ios to store extra state information for binary I/O.

class iosb : public virtual ios {
public:
    iosb();
    ~iosb();

    boolean binary() const;
    void binary(boolean);
    boolean swapped() const;
    void swapped(boolean);
protected:
    boolean _binary;		// are my peer and I performing binary I/O?
    boolean _swapped;		// does my peer have a swapped endian?
};

// Modify istream to extract unformatted data where possible for
// faster I/O throughput and to discard delimiters automatically.

class istreamb : public virtual iosb, public istream {
protected:
    istreamb();
public:
    istreamb(streambuf*);
    ~istreamb();

    istreamb& operator>>(char&);
    istreamb& operator>>(unsigned char&);
    istreamb& operator>>(short&);
    istreamb& operator>>(unsigned short&);
    istreamb& operator>>(int&);
    istreamb& operator>>(unsigned int&);
    istreamb& operator>>(long&);
    istreamb& operator>>(unsigned long&);
    istreamb& operator>>(float&);
    istreamb& operator>>(double&);
    istreamb& operator>>(char*);
    istreamb& operator>>(unsigned char*);

    istreamb& operator>>(istream& (*)(istream&));
    istreamb& operator>>(ios& (*)(ios&));
};

// Modify ostream to insert unformatted data where possible for faster
// I/O throughput and to delimit formatted data automatically.

class ostreamb : public virtual iosb, public ostream {
protected:
    ostreamb();
public:
    ostreamb(streambuf*);
    ~ostreamb();

    ostreamb& operator<<(char);
    ostreamb& operator<<(unsigned char);
    ostreamb& operator<<(short);
    ostreamb& operator<<(unsigned short);
    ostreamb& operator<<(int);
    ostreamb& operator<<(unsigned int);
    ostreamb& operator<<(long);
    ostreamb& operator<<(unsigned long);
    ostreamb& operator<<(float);
    ostreamb& operator<<(double);
    ostreamb& operator<<(const char*);
    ostreamb& operator<<(const unsigned char*);

    ostreamb& operator<<(ostream& (*)(ostream&));
    ostreamb& operator<<(ios& (*)(ios&));
protected:
    void fixwidth();
};

// Replace iostream with a stream that inserts and extracts
// unformatted data where possible for faster I/O throughput and
// delimits formatted data automatically.

class iostreamb : public istreamb, public ostreamb {
protected:
    iostreamb();
public:
    iostreamb(streambuf*);
    ~iostreamb();

    void negotiate(boolean binary);
};

#endif
Technical Details
Message-ID: <9301261541.AA19734@lin.isy.liu.se>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!sun-barr!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!isy.liu.se!garp

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!sun-barr!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!isy.liu.se!garp
From: garp@isy.liu.se (Johan Garpendahl)
Newsgroups: gnu.g++.lib.bug
Subject: Problems with InterViews' iostreamb class
Date: 26 Jan 1993 22:11:37 -0500
Organization: GNUs Not Usenet
Lines: 138
Sender: daemon@cis.ohio-state.edu
Approved: bug-lib-g++@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9301261541.AA19734@lin.isy.liu.se>