HDTenEightyP/NetNews huggingface dataset:
From: jason@lanai.cs.ucla.edu (Jason Rosenberg)
Subject: Need help on class fstream (can't find any doc)
Originator: jason@lanai.cs.ucla.edu
Organization: UCLA Computer Science Department
Date: Tue, 8 Sep 92 10:54:12 GMT

Hello,

I have been playing around with the class fstream in the g++ library.  I
am trying to understand its intended usage and how best to use it.
I was unable to find any documentation about it.  

The open method returns a void.  What is the best way to test if the open
operation was a success.  So far, I have only been able to successfully
use the filedesc() method, to test if it is not -1.  Is there any other
way?

I am trying to create a derived stream class that can be assigned freely
to cout,cin and cerr, and to read and write to files.  So far, fstream
is the only "base" class I can use from the g++ library.  However,
I have not been able to get it to work (see my bug report post on
gnu.g++.lib.bug).

Thanks for any help.....

Jason


-- 
Jason Rosenberg                           Computer Science Department
jason@cs.ucla.edu                         University of California
{uunet,rutgers,ucbvax}!ucla-cs!jason      Los Angeles, CA  90024
Newsgroups: gnu.g++.help
From: edstrom@hsc.ucalgary.ca (John Edstrom)
Subject: Re: how to do this?
Date: Sun, 13 Sep 92 17:01:50 GMT
Organization: Neuroscience Division, U of Calgary School of Medicine, Calgary, Alberta, Canada
Keywords: pointer to member

In article <1992Sep12.160053.28778@isy.liu.se> svan@isy.liu.se writes:
>> What is wrong with the
>> following constructions and how can I do it in g++?
>>
>> ----------
>>
>> class a {
>> public: 
>>	int x();
>> };
>>
>> int a::x() { return 1; }
>>
>> main() {
>>	printf("%x\n", (int(*))a::x);
>> }
>
>You're trying to cast a pointer to member to a pointer to object
>type. That can't be done according to the standards
>documentation I've read over C++ (Annotated C++ Ref. Man. by
>Ellis & Stroustrup). 

To a member function, not just a member.  It can be done because I
encountered it while trying to port some code from AT&T C++ to g++.
It just doesn't seem to be possible in g++.

>Pointer to members may even not be explicitly converted to void*!
>
>The reason for this is that pointers to members may be
>a structure containing both addresses and offsets. There is
>no point in allowing a cast to any ordinary pointer.
>

There is if you want to choose different functions at a certain point
in a program depending on current circumstances.  Sorting elements by
different criteria, for example.


The workaround I've discovered is as follows :

typedef int (a::*afp)( void );   // can not do it without typedef and
				 // using intermediate variables
class a {
public:
  int a(void);
  int b(void);
  int c(void);
};

int a::a(void) { return 1; }
int a::b(void) { return 2; }
int a::c(void) { return 3; }

main() {
  afp y = a::x;

  printf("%x\n", y);  //  this gives me the address of the member
		      //  function 
}


But still I can't execute the function directly like its seems I
should be able to:

inline int a::do_something( afp x ) { return x(); }   // no way


The only way I can get it to go is to have another member function
like: 

int a::executor(cfp x) {
  if (x == a)
    return a();
  if (x == b)
    return b();
  if (x == c)
    return c();
}


Where to get the value from a passed member function pointer the usage
is: 

inline int a::do_something(afp x ) { return executor(x); }   


I know this is ugly and stupid and I hope there is a better way.


>O----------------------------O----------------------------------O
>| Jonas Svanberg             | Email: svan@isy.liu.se           |
>| Div. of Information Theory O----------------------------------O
>| Department of E.E. (ISY)   | "And Noah said to the animals:   | 
>| Linkoping University       |  - Go out and multiply!          |  
>| S-581 83 Linkoping         |  The snake said:                 |
>| SWEDEN                     |  - But how can I? I'm an adder!" |
>O----------------------------O----------------------------------O
>


JE
--
 RM 2104, HSc Building,  Div. Neuroscience
 U. Calgary School of Medicine,  3330 Hospital Drive NW
 Calgary, Alberta       T2N 3Y4
 (403) 220 4493  (wk)
From: curtis@WJ.COM (Curtis Otaguro)
Newsgroups: gnu.g++.help
Subject: QUESTIONS: g++ for SunOS 4.1.3
Summary: What's the latest stable rev of g++, where can I get it from
Keywords: g++ source documentation c++ guidelines
Date: 11 Sep 92 21:42:11 GMT
Distribution: usa
Organization: Watkins-Johnson Company

I would like to know what the latest, stable rev of g++ is, and where
I can ftp it from.  I will be compiling it on a Sun IPX running SunOS
4.1.3.  I would also like to know whether documentation is available
for it.

On a different subject, can anyone suggest a good reference for c++
programming guidelines?

Thanks in advance!
                                                          ...Curtis
-- 
Curtis Otaguro              Phone: (408) 439-6119         ~~~ GO GIANTS!        
Sr. Electrical Engineer     Email: curtis@wj.com           ~~~ BOWS NO KA OI!
Watkins-Johnson Company     Pmail: 440 Kings Village Rd    
Single Wafer Products              Scotts Valley, CA, 95066-4081       
Newsgroups: gnu.g++.help
From: rune@nta.no (Rune Henning Johansen FBA)
Subject: How to avoid warning: implicit declaration of function 'printf'
Organization: Norwegian Telecom Research
Distribution: gnu
Date: 8 Sep 92 10:23:35


Using printf in my g++-program the compiler gives
    warning: implicit declaration of function `printf'
How can I avoid this?

 - Rune

Newsgroups: gnu.g++.help
From: karl@thuja.gsfc.nasa.gov (Karl A. Anderson)
Subject: Installing g++-1.41.0 under SunOS 4.1.3
Organization: NASA/GSFC Laboratory for Terrestrial Physics
Date: Wed, 9 Sep 1992 23:47:20 GMT

The README file says the directory ../gcc-test/ should exist relative to the g++
build directory.  Apparently, it should contain at least one file, gcc.  How does
gcc get into gcc-test?  Should gcc-test just be a link to the gcc-1.41 build
directory?
-- 
Karl A. Anderson		| Internet: karl@thuja.gsfc.nasa.gov
NASA/GSFC code 920.2 (HSTX)	| voice: (301) 286-3815
Greenbelt, MD 20771		| #include "std_disclaimer"
Newsgroups: gnu.g++.help,comp.lang.c++
From: thoennis@picasso.informatik.rwth-aachen.de (Hans Juergen Thoennissen)
Subject: linking template classes
Organization: University of Aachen, W-Germany
Date: Tue, 8 Sep 1992 11:57:47 GMT

Hello,

this is my first posting in the usenet so please sorry for choosing the wrong groups ..... but I need help !!!

I have a problem with the GNU C++ V2.1 Compiler on my SPARCstation SLC, using  sunos4.1.1 !!!

The problem is the following:

FILE1:         foo_test.cc

#include "foo.h"

main() {
	Array<int> ALF;
}

FILE2:       foo.h

template <class Typ>
class Array {
public:   Array() {Init();}
private: void Init();
};

FILE3:     foo.cc

#include "foo.h"
template <class Typ> void
Array<Typ>::Init() {
}


COMMANDS:

g++ -c  foo.cc
g++ foo_test.cc foo.o

This results in the following linker error:

ld: Undifined symbol
      _Init__t5Array1Zi
collect:   /usr/bin/ld returned 2 exit status


But if I put all 3 files in one, it works. 

It seems, that the linker has a problem with the template class. 
Can anybody explain what I am doing wrong or if something is not
installed correctly.

Thanks in advance

Hans-Juergen




Newsgroups: bnr.lang.c++,gnu.g++.help
From: crlstu4@bnr.ca (Goetz von Escher)
Subject: overloading delete operator in a base class
Keywords: gnu, c++, operator, delete
Organization: Bell-Northern Research, Ottawa, Ontario, CANADA
Date: Fri, 11 Sep 92 15:03:40 GMT

Hi folks!

I'm facing a simple problem. Maybe YOU can help:

----------------------------------------------------------------
MAIN PROBLEM:
----------------------------------------------------------------
I want to keep track of the size of memory used by objects of
specific classes (they are all derived from a common base
class). So I override the new and delete operators of the
base class and let a global integer count the number of
bytes used.

To implement this I have to know the size of an object when it
is deleted.

----------------------------------------------------------------
GNU PROBLEM:
----------------------------------------------------------------
I want to overload the delete operator inside a class, using the
two argument style (as expained in "The Annotated C++ reference
manual" by Ellis/Stroustrup in section 12.5) as:

   void operator delete(void*, size_t);

Unfortunately g++ (version 2.2.2) does not accept this, as
you can see when you try to compile the following code. If I
remove the two occurrences of size_t the program works well.

Is this a gnu bug/feature or am I missing something here?

----------------------------------------------------------------
TRY TO COMPILE THIS PROGRAM:
----------------------------------------------------------------
extern "C" {
#include <stdlib.h>
}
#include <iostream.h>

class Simple {
   public:
      Simple()  { cout << "constructor\n"; };
      ~Simple() { cout << "destructor\n"; };

      void operator delete (void*, size_t);
};

void Simple::operator delete (void* o, size_t s) {
   cout << "delete\n";
   ::delete(o);
}

int main() {
   Simple* s = new Simple();
   delete s;
   return 0;
}
----------------------------------------------------------------
ERROR MESSAGE PRODUCED ON MY COMPUTER (SUN SPARC):
----------------------------------------------------------------
[c++]% g++ overloading.delete.cxx
overloading.delete.cxx: In method `Simple::~Simple ()':
overloading.delete.cxx:9: too few arguments for method `operator delete'


Thanks for any suggestions...

----------------------------------------------------------------
Goetz von Escher             PHONE (613) 763-8681
14 Viewmount Dr              EMAIL crlstu4@bnr.ca
Nepean, Ontario K2G 1R5
CANADA
----------------------------------------------------------------
Newsgroups: gnu.g++.help
From: liblit@cs.psu.edu (Benjamin R. Liblit)
Subject: default copy constructor?
Distribution: gnu
Date: Thu, 10 Sep 1992 09:09:54 GMT

I would like to construct an instance of a derived class using an
instance of its base class.  The plan is to use the base class's copy
constructor (a.k.a. "X(X&)") to initialize the inherited portions, and
initialize the rest explicitly.  Thus:

	struct Base
	{
	  int b;
	};

	struct Derived : public Base
	{
	  int d;
  
	  Derived(const Base &shared)
	  : Base(shared),
	    d(1)
	    {
	    }
	};

G++ 2.2.2 reports the following errors:

	try.cc: In method `Derived::Derived (const struct Base&)':
	try.cc:13: no constructor found for initialization of `Base'

I had thought that *all* structures/classes/types had a default copy
constructor defined for themselves.  This error seems to hint
otherwise.  Am I confused or is G++?

If I do explicitly define a copy constructor for the base class, the
errors disappear.  However, doing so in the real code I'm working on
is not a feasible solution.

Any ideas?
--
Ben Liblit   -----   "Fais que tes reves soient plus longs que la nuit."
liblit@cs.psu.edu   --   brl102@psuvm.psu.edu   --   brl102@psuvm.bitnet
Newsgroups: gnu.g++.help
From: isclimcl@nuscc.nus.sg (Lim Choon Long)
Subject: installing libg++ 2.2 in sun386i
Organization: National University of Singapore
Date: Tue, 8 Sep 1992 06:49:15 GMT

Hi,

I have installed gcc 2.2.2 on a sun386i running 4.0.2 but I have problems
nstalling libg++-2.2.

(1) when I 'make' in the libg++-2.2 directory, I got:
---------------------
cc -g -nostdinc++ -I.. -I. -I./../iostream -I./../g++-include  -c
AllocRing.cc 
cc: Option -n misformed as -nostdinc++
*** Error code 1
make: Fatal error: Command failed for target `AllocRing.o'
---------------------

(2) If I 'make' in the /libg++-2.2/libg++ directory, I got:
---------------------
gcc -g -nostdinc++ -I.. -I. -I./../iostream -I./../g++-include  -c
AllocRing.cc
In file included from ./std.h:26, from AllocRing.cc:22:
./../g++-include/string.h:28: declaration of `int  strlen (const char
*)'
<built-in>:0: conflicts with built-in declaration `long unsigned int
strlen (const char *)'
*** Error code 1
make: Fatal error: Command failed for target `AllocRing.o'
---------------------

(3) I found the following message in g++-include/string.h:
---------------------
// NOTE: If you get a error message from g++ that this declaration
// conflicts with a <built-in> declaration of strlen(), that usually
// indicates that __SIZE_TYPE__ is incorrectly defined by gcc.
// Fix or add SIZE_TYPE in the appropriate file in gcc/config/*.h.
---------------------

Can someone please explain to me what are the steps involved in (3)?
Besides these, is there any other fixes to be made in order to get g++
running in my system?

Thanks.

Choon-Long Lim
email: limcl@iscs.nus.sg
       limcl@nusdiscs.bitnet
From: henry2@davinci.concordia.ca
Newsgroups: gnu.g++.help
Subject: Help with installing g++ 2.2 on VAX VMS needed.
Date: 15 Sep 92 16:55:50 GMT
Distribution: na
Organization: ECE - Concordia University
Originator: henry2@davinci


Has anyone had luck installing g++ 2.2 under VMS from the compressed 
savesets on mango? I have been unable to decompress the save sets.
Any help would be appreciated.

Henry Polley
henry@chdasic.sps.mot.com
Newsgroups: gnu.g++.help
From: pcm@cs.brown.edu (Peter C. McCluskey)
Subject: Re: Problem with virtual destructors
Organization: Brown Computer Science Dept.
Distribution: gnu
Date: Tue, 15 Sep 1992 19:55:46 GMT

In article <6334@transfer.stratus.com>, lee@bluefuzz.sw.stratus.com (Lee Cooprider) writes:
|> I am using C++ from gcc version 2.2.1 on a Sparc platform.
|> 
|> My problem is with virtual destructors.  Whenever my real destructor is
|> called, the program abort()'s after executing the destructor successfully.
|> 
|> This program illustrates the problem:
|> 
|> 	class aaa {
|> 	  public:
|> 	    virtual ~aaa() = 0;};
|> 	
|> 	class bbb : public aaa {
|> 	  public:
|> 	    bbb();
|> 	    ~bbb();};
|> 	
|> 	bbb::bbb() {}
|> 	bbb::~bbb() {}
|> 
|> The assembler for ~bbb() has an unconditional abort() call at the end.  Is
|> this the correct code?  Is there an additional requirement on virtual
|> destructors?  Is it not legal for a destructor to be pure-virtual?

This is a bug in g++. The way cfront works (which is apparently the correct
way, although I haven't found a convincing explanation of why) is that a
definition of aaa::~aaa(){} is needed even though it is pure, because derived
class destructors always produce an implicit call to their base class destructors.
cfront gives a warning during compilation saying that the definition must be
provided.

----------------------------------------------------------------------
  \\ !Vote Libertarian! \\ Peter McCluskey  \\ !Vote Libertarian! \\
  // Vote Marrou in `92 // pcm@cs.brown.edu // Vote Marrou in `92 //
----------------------------------------------------------------------
Newsgroups: gnu.g++.help
From: ernest@pundit.cithep.caltech.edu (Ernest Prabhakar)
Subject: When/Where/what is GCC 2.3?
Reply-To: ernest@pundit.cithep.caltech.edu (Ernest Prabhakar)
Organization: California Institute of Technology, Pasadena
Date: Wed, 9 Sep 1992 20:21:38 GMT

Forgive me if I'm off base, here but:

Several people in this newsgroup and gnu.g++.bugs have made comments like,  
"That's fixed in the new release."  I assume they are referring to GCC 2.3.

I was wondering:
- where is it being worked on?
- what all will be in it?
- when will it be available?

Is there someplace I can go to find this out?  Should I already know all this?

Thanks,
- Ernie P.

--
Ernest N. Prabhakar                  Caltech High Energy Physics
Member, League for Programming Freedom (league@prep.ai.mit.edu)
CaJUN President        NeXTMail:ernest@pundit.cithep.caltech.edu
"...and ourselves, your servants for Jesus sake." - II Cor 4:5b
#import <std/disclaimer.h>
From: greene@newton.ccs.tuns.ca (Courtney Greene)
Newsgroups: gnu.g++.help
Subject: g++ installation on hp9000 835
Date: 10 Sep 92 14:20:15 GMT
Organization: Technical University of Nova Scotia, Halifax, N.S.

Hello,

I'm trying to install g++-1.40.3 on an hp9000 Series 800 machine. I'm at the 
point now were I'm to run config.g++. One of the cases in config.g++ is 
hp9k800 but when I specify it I get an error. Following is the error message:

# ./config.g++ hp9k800
./config.g++: cannot create a link `config.h'
since the file `config/xm-hp9k8.h' does not exist.

Where can I find xm-hp9k8.h? Or is there another solution.

Thanks,
Courtney Greene
greene@tuns.ca
Newsgroups: gnu.g++.help
Subject: help with Random class
From: fsb@sparc.vitro.com (Steve Brailsford)
Date: 3 Sep 92 13:16:02 GMT
Keywords: random numbers
Summary: How do I use it?


I see there is some kind of random number generator class
in g++ lib.  Can someone give me an example on how to use it?
It'd like say a random number between 10 and 20.  I think there
is a way to get it to do that, but haven't figured out how.
I wish there were some examples in the comments or something.
Man pages would be nice too. :-)

--
    Steve Brailsford (fsb@sparc.vitro.com)   _____
    Usenet:  uupsi!vitro!sparc!fsb         \/itro Corporation
    Voice:  (301) 231-1481                  14000 Georgia Ave.
    Fax:    (301) 231-2020                  Silver Spring, MD 20906
Newsgroups: gnu.g++.help
From: bitbug@netcom.com (James Buster)
Subject: problem with collect in g++ 2.x
Date: Fri, 11 Sep 92 01:19:37 GMT
Organization: Lynx Real-Time Systems, Inc.

Collect appears to be working incorrectly.

Here is my understanding of how collect is supposed to work, given the command
line
	/path/collect -o t t.o -lg++

/path/real-ld -r -o /path/to/temp/file t.o -lg++

scan output of "nm -p /path/to/temp/file" to find constructors/destructors.

Create an assembly language file (/path/to/asm/file.s).

/path/to/c/compiler -c /path/to/asm/file.s -o /path/to/asm/file.o

/path/real-ld -o t /path/to/temp/file /path/to/asm/file.o

We are now finished linking. Instead, collect appears to do this:

/path/real-ld -o t t.o -lg++

Note the lack of -r, and the wrong output file name. Our linker complains
about symbols not being resolved (constructors), and the link fails. Since
the link failed, nm is never called.

This seems so wrong that either I have done something horribly wrong, or
collect is rather broken.
-- 
				James Buster
			     bitbug@netcom.com
Newsgroups: gnu.g++.help
From: svan@isy.liu.se (Jonas Svanberg)
Subject: ld: Undefined symbol __$_9xxx
Keywords: ld link linker linking constructor
Reply-To: svan@isy.liu.se
Organization: Linkoping University
Date: Sat, 12 Sep 1992 15:39:55 GMT

I believe I have the same problem as Mr D. Vladicic in his 
contribution "C++ constructor problem"

I have a case when a static initialization of the form:

#include "Package.hh"
static Package* pac1 = new Package("pac 1");

will work but this:

static Package pac2("pac 2");

won`t work 'cause the linker complaines about __$_9Package
as an undefined symbol. I don't quite get it why the former
works and the latter won't. Both initializations are
swallowed by the compiler.
The class Package is separately compiled, but that shouldn't
affect the result, should it?
I use g++ 2.2 and am running on a Sun Sparc1.

I can do with the pointer initialization but it's irritating
nevertheless...

O----------------------------O----------------------------------O
| Jonas Svanberg             | Email: svan@isy.liu.se           |
| Div. of Information Theory O----------------------------------O
| Department of E.E. (ISY)   | "And Noah said to the animals:   | 
| Linkoping University       |  - Go out and multiply!          |  
| S-581 83 Linkoping         |  The snake said:                 |
| SWEDEN                     |  - But how can I? I'm an adder!" |
O----------------------------O----------------------------------O

Newsgroups: gnu.g++.help
From: ckincy@cs.umr.edu (Charles Kincy)
Subject: Where can I find g++ object library documentation?
Date: Sun, 13 Sep 1992 22:47:39 GMT
Distribution: na
Organization: University of Missouri - Rolla
Originator: ckincy@mcs213c.cs.umr.edu

Subject line says it all.  Please be specific (e.g. give directory).
Email responses are fine.

Thank you very much!

cpk
From: mahesh@evb.com (B.G. Mahesh)
Newsgroups: gnu.g++.help
Subject: Help needed for installing g++ on a Solbourne
Date: 15 Sep 92 20:43:35 GMT
Reply-To: mahesh@evb.com

Hi,

I am trying to install g++-1.40.3 on my Solbourne. 
I installed gcc-1.40 recently.

I have some questions .....

* I don't see lib++-1.40.3 directory in my distribution. Do you folks
  recommend me to get it? If so, where can I get it?

* I don't have the bison parser. should I install it and if so,
  where can I get it?

* I don't has GAS and GNU ld. should I ......(you know what)

* Initially is the directory gcc-test supposed to be an empty
  directory? (for installing g++)

Please respond by email only.

thanks



-- 

B.G. Mahesh
mahesh@evb.com
Newsgroups: gnu.g++.help
From: gene@zehntel.com (Eugene Wedge)
Subject: I've missed some GNUs.
Followup-To: gene@zehntel.com
Summary: Where can I get g++-2.2.2.tar.Z?
Organization: Teradyne Inc, ATE Division, Walnut Creek, CA
Distribution: gnu
Date: Fri, 4 Sep 1992 06:50:05 GMT

I've been happily tinkering with g++ 1.39 for about a year, and I thought
it was about time to check in on the net and see if there was a 2.x around
yet.  My local news program said "Skipping unavailable articles" for group 
gnu.g++.announce but lo and behold, people are talking lots about g++ 2.2.2.
So I go looking happily on my favorite ftp archive sites for it.  Unhappily
I don't find it.  So what gives?  OK, I know I should read the news more
often, but maybe somebody can fill me in.  Do I have to buy a tape?  Yeah,
I know should be willing to support the cause, but has FSF really given up
on us part time midnight hackers with no budget?

Thanks in advance for any explanation/leads.

Gene Wedge           | The law should be considered as a LAST resort in any
gene@zehntel.com     | attempt to change people's behavior.
Teradyne, Inc.,      |---------------------------------------------------------
Zehntel Division     | My own opinions - not necessarily my employers'.
-- 
Gene Wedge           | The law should be considered as a LAST resort in any
gene@zehntel.com     | attempt to change people's behavior.
Teradyne, Inc.,      |---------------------------------------------------------
Zehntel Division     | My own opinions - not necessarily my employers'.
Newsgroups: gnu.g++.help
From: svan@isy.liu.se (Jonas Svanberg)
Subject: Re: how to do this?
Keywords: pointer to member
Reply-To: svan@isy.liu.se
Organization: Linkoping University
Date: Sat, 12 Sep 1992 16:00:53 GMT

> What is wrong with the
> following constructions and how can I do it in g++?
>
> ----------
>
> class a {
> public: 
>	int x();
> };
>
> int a::x() { return 1; }
>
> main() {
>	printf("%x\n", (int(*))a::x);
> }

You're trying to cast a pointer to member to a pointer to object
type. That can't be done according to the standards
documentation I've read over C++ (Annotated C++ Ref. Man. by
Ellis & Stroustrup). 
Pointer to members may even not be explicitly converted to void*!

The reason for this is that pointers to members may be
a structure containing both addresses and offsets. There is
no point in allowing a cast to any ordinary pointer.

O----------------------------O----------------------------------O
| Jonas Svanberg             | Email: svan@isy.liu.se           |
| Div. of Information Theory O----------------------------------O
| Department of E.E. (ISY)   | "And Noah said to the animals:   | 
| Linkoping University       |  - Go out and multiply!          |  
| S-581 83 Linkoping         |  The snake said:                 |
| SWEDEN                     |  - But how can I? I'm an adder!" |
O----------------------------O----------------------------------O

Newsgroups: gnu.g++.help