HDTenEightyP/NetNews huggingface dataset:
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Indirect container classes
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Mon, 21 Dec 1992 10:03:39 GMT

In article <1992Dec20.232025.28984@county.oz.au> porum@county.oz.au (Peter Orum) writes:
>Could someone advise on what is the best method of
>having a collection of pointers to large objects. 

	I doubt anyone could advise you on the *best* method,
at least without risking a few flamethrowers.

>The
>large objects may appear on more than one list, but I
>only want one instance of each object  to be created.
>
>	a)	a list of pointers, eg List<String *>
>	
>	b)	a list class that assumes its  data are pointers
>		eg Indirect_List<String *>
>		
>	c)  use List<String>, but class String is implemented using
>		a pointer to a reference-counted String_rep.
>		
>To  me,  method  a)  is  the easiest to implement but you lose
>the  ability  to  test  for  list  membership  by  content, as
>comparison is on absolute memory addresses.
>
>Method  b)  has  the  disadvantage  of (slightly) complicating
>the   List   class, requiring  overloading  of  the  comparison
>operators, search & copy functions.
>
>Method  c)  complicates the class definition, but means in the
>client  code  I  don't have to decide on which type of List to
>use, nor whether to use pointers or objects.
>
>What do other people do? 
>

	c) looks most worth perusing to me. Without reference
counting (a or b), how do you plan to delete the large objects
when they are no longer required? (Or rather, how will
you know when they are no longer required?)

	For more techniques purchase Coplien, "Advanced C++
Programming Styles and Idioms".


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
From: jbuck@foucault.berkeley.edu (Joe Buck)
Newsgroups: comp.lang.c++
Subject: Re: Gnu C++ - what did I miss?
Date: 29 Dec 1992 22:43:10 GMT
Organization: U. C. Berkeley
NNTP-Posting-Host: foucault.berkeley.edu

In article <1992Dec29.220701.5724@adimail.uucp> tel@adimail.uucp (Terry Monks) writes:
>I just installed Gnu g++ version 2.3.2, but...where am I
>supposed to get <stream.h> from?
>
>(my version is sparc-sun-sunos4.1)

It's in the libg++ distribution, which you can probably get from
the same place you got gcc/g++ from.  I also suggest that you get
2.3.3; it has many bug fixes (2.3.1 was a botch, which is why there
have been all these triple-number releases).



--
Joe Buck	jbuck@ohm.berkeley.edu
Newsgroups: comp.lang.c++
From: 76336.3114@CompuServe.COM (Kevin Dean)
Subject: Private base classes
Date: 21 Dec 92 18:55:42 GMT

From John Max Skeller, <1992Dec19.185132.13319@ucc.su.OZ.AU>:

>In article <921216205429_76336.3114_EHJ34-2@CompuServe.COM>
>76336.3114@CompuServe.COM (Kevin Dean) writes:
>>
>>I tried to do the following:
>>
>>class A {};
>>class B : private A {};
>>class C1 : public B, public A {};
>>
>>My compiler naturally warned me about A being both a direct and indirect
>>base class of C1 and so refused to compile it.

>     It was nice for your compiler to warn you.
>     It was wrong for it to refuse your perfectly valid request.
>     Your compiler is broken.

>     Replicated *direct* bases are illegal, if only because there would
>     be no way to disambiguate them.

According to a note sent directly to me by Steve Clamage of TauMetric
Corp and, I believe, the C++ language committee, the construct is indeed
ambiguous because access rights are checked only after ambiguities are
resolved; trying to do it the other way around would introduce other
problems.  Given that access priviliges have no bearing on ambiguity
resolution, what I was trying to do is illegal.

However, that said, I still think there should be a way to do this, if
only because, once a class is defined and documented, it can't be reliably
changed even if the public and protected interfaces remain the same.

>>In other words, I need to have forward
>>knowledge of all classes that are or could be derived from B. 
>>Similarly,I need to know more about B than just its public and
>>protected interfaces; I need to know what its private base classes are
>>before I can reliably use it as a base class.

>     Yes, and this is why others believe private *should* mean
>hidden, so you dont have to know about implementation details.

>So what do you think of that?

It's got my vote. 

Kevin Dean


Newsgroups: comp.lang.c++
From: khcheng@unix.amherst.edu (KIM HONG CHENG)
Subject: MS C/C++ 7.0 & SDK 3.0 sale
Organization: Amherst College
X-Newsreader: TIN [version 1.1 PL7]
Date: Sun, 3 Jan 1993 21:34:19 GMT

MS C/C++ 7.0 + SDK 3.0
* still in plastic wrap (never been used)
* registration card included
* 45 lb of manuals (all manuals never been used)
* $200 +shipping
(I think this is more than $600)

Hong Cheng
327 Lincoln Ave.
Amherst, MA 01002

413-542-8084 (day)
413-549-4690 (eve & weekend)
From: joe@proto.com (Joe Huffman)
Newsgroups: comp.lang.c++
Subject: Re: BORLAND C++ ; new int(1,000,000)
Date: 31 Dec 92 00:05:56 GMT
Organization: FlashTek, Inc.

ghica@fig.citib.com (Renato Ghica) writes:

>Is it possible to allocate more than 640K (from extended or
>expanded memory) on a DOS 5.0 system using a borland 3.1 C++ program?

>Using the huge memory model, I'm trying to do the equivalent
>of 
>	new int(1,000,000);  

Sorry, you will need a 32-bit compiler for DOS to do that.  MetaWare and
Zortech have the only 32-bit C++ compilers for DOS that I am aware of
right now.  Watcom is supposed to have something available soon, but I don't
think it is out yet.
-- 
netcom!proto!joe
joe@proto.com
Newsgroups: comp.lang.c++
From: suwanto@iastate.edu (zapper)
Subject: Re : Converting EXE c++ files back to source code
Organization: Iowa State University, Ames IA
Date: Wed, 30 Dec 1992 05:31:23 GMT

> I have some old C++ programs that I written 2 or 3 yrs ago.  I have more 
> EXE files than C++ source code.  Some of these programs I've written are
> quite good but I only have the EXE file that the compiler created.  I
> was wondering if there is a way to convert the EXE files back to there
> original source code?  Can it be done?

It is not possible to do this! If there was such a tool, then it would be
a lot easier for us to modify all EXE and COM programs out there.

-twb51@isuvax@iastate.edu
  
-- 


/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
|                                  *                                     |
Newsgroups: comp.lang.c++
From: wright@staff.tc.umn.edu (Mark Wright)
Subject: Re: Borlands next C++ release?
Organization: University of Minnesota
Date: Wed, 30 Dec 1992 22:38:26 GMT

In article <1992Dec30.214129.12252@nscf.org> warren@nscf.org (L3 Warren) writes:
>ericm@ims.com (Eric Martinson) writes:
>
>>I saw an add for Turbo Pascal with Objects on the back cover of a magazine.
>>I personally could care less about Pascal Object Oriented Programming (POOP)
>>but I was interested in the claim of a DPMI extender included with the package.
>>Has anyone heard if Borland International plans on including such an extension
>>with the next release of Borland C++? Any rumors and/or suggested availability
>>dates?
>
>If memory has not failed me, they included the Phar Lapp dos extender with
>the 3.1 release of BC++. Quite some time ago.
>
>Warren.
>

Well, there's a disk containing the extenter in the box.  You don't get any
documentation with it (except a few .doc files on the disk), and its not at
all integrated with the compiler.  Really, its just a pitch to get you to buy
the real (and $500+) extenter.  As far as I know, TP's extender is part of the
TP compiler, can be used seamlessly within the IDE, etc...
-- 
Mark Wright
wright@epx.cis.umn.edu
Newsgroups: comp.lang.c++
From: jamesa@duke.colorado.edu (Jim Anderson)
Subject: Socket class
Originator: jamesa@duke
Keywords: bsd sockets
Organization: University of Colorado, Boulder
Date: Thu, 31 Dec 1992 19:03:29 GMT

I'm wondering if anyone out there has or knows of a class that "does"
bsd sockets.  It doesn't seem like too difficult a task, but then again,
I don't know that much about sockets and would prefer not having to 
re-invent the wheel.

Thanks for any pointers.
jima
jamesa@boulder.colorado.edu

Newsgroups: comp.lang.c++
From: madagil@eecs.umich.edu (Martin Giles)
Subject: Looking for C++ Exception Library
Reply-To: madagil@eecs.umich.edu
Organization: University of Michigan
Date: Mon, 28 Dec 1992 21:46:13 GMT

Can someone point me to a library which provides (at least, to some degree)
exception handling capabilities.  I can remember reading about one, but now
cannot track down where I saw it.

	Martin Giles
	madagil@eecs.umich.edu


Newsgroups: comp.lang.c++
From: wlrobert@silver.ucs.indiana.edu (william lester roberts)
Subject: Re: Wanted C++, LEX++, YACC++ etc.
Summary: Please post
Organization: Indiana University
Date: Fri, 25 Dec 1992 14:46:19 GMT

In article <15010002@hpsgwr.sgp.hp.com> plim@hpsgwr.sgp.hp.com (Peter Lim) writes: (edited)
>
>As the above might not be of interest to the general public, please e-mail
>me if you have any info. Thanks.
>
It is so of intrest, at least to me.  Post here.

Bill Roberts
Ellettsville, IN



Newsgroups: comp.lang.c++
From: pauljo@microsoft.com (Paul Johns)
Subject: Re: Can't I initialize a dynamically allocated object in its constructor?
Date: 22 Dec 92 23:44:20 GMT
Organization: Microsoft Corp.
Distribution: usa

You've made common beginning mistake #1:  not defining
your own copy constructor when one is needed.

Your code WILL NOT WORK correctly until you provide a proper
copy constructor.  The fact that it seems to work in one case 
is not the whole story:  it is actually failing in subtle 
ways you're not looking at.  And the initialization you ask
about is not the issue here.

What's going on is that since you didn't provide a copy
constructor, the compiler provides one for you which simply
copies the members of your class one member at a time.

But the data in the vector doesn't get copied--only the pointer.  
And you end up deleting data twice since two different objects 
point to it.

This is really bad--it tends to mess up the heap something awful.

There is at least one C++ book whose author tells nothing
of copy constructors.  I hope you didn't use that one!!!

Good texts (Lippman, Stroustrup, various Microsoft Press books,
etc.) do a good job of explaining copy constructors and why 
they're needed.  Check out the dynamic string classes, which 
are very similar to your vector class.

If your class needs an assignment operator, it will almost
certainly need a copy constructor and destructor as well.

Two other points I noticed in your code:

1.  You assignment operator doesn't check for doing "a = a;"  Also,
	it DOES make sense to assign vectors of different sizes,
	you may want to allow that.  Check how a good dynamic
	string class works for ideas.

2.  operator + is usually implemented as a file-scope (global)
	function so that both operands can be converted, not
	just the RHS operand.  In your particular case, you
	don't have any useful (meaning you'd want to write
	something like "vecx = 5 + vecy;") conversions, so 
	this isn't an issue.  You may want to rethink the
	int constructor since it provides an implicit conversion
	from int to vector, meaning that an int or any expression
	that can be converted with a standard conversion to an
	int can be used any place a vector can.  (So "vec2 + 5"
	**IS** legal for your class, although meaningless.)

Good luck!

// Paul Johns
From: av@kielo.uta.fi (Arto V. Viitanen)
Newsgroups: comp.lang.c++
Subject: Novell to buy USL ? What happens to C++ ?
Date: 28 Dec 92 10:42:09 GMT
Reply-To: av@uta.fi (Arto V. Viitanen)
Distribution: comp
Organization: University of Tampere, Finland

In newsgroup comp.unix.misc was a post of brian@piano.grot.starconn.com
(Brian Smithson) about Novell Inc. to buy USL from AT&T. Novell's reasons for
the buy are Novell's increasing interest on Unix. My question is: what does
this do to C++ ? Will AT&T continue to develope C++ language's real standard,
CFront, or will Novell take it also ?
--
Arto V. Viitanen				               email: av@uta.fi
University Of Tampere,				   	           av@cs.uta.fi
Finland
From: dijk@cwi.nl (Valentijn van Dijk)
Newsgroups: comp.lang.c++
Subject: classes needed for tree of vectors
Summary: classes needed for tree of vectors
Keywords: vectors,matrix,graphs
Date: 23 Dec 92 16:24:58 GMT


I haven't done very much programming in c++, but I need a library
which has the following:

datatype Tree, including elementary operations like traversal.
	 Set,  only very simple operations needed
	 Vectors, of up to 10 elements

	 Some simple matrix operations to work in conjunction with the
	 vectors would be welcome as well. The matrix and vector
	 packages I've seen (i.e. Newmat06) are much too big and
	 complex for my purposes. All I want to build really is a tree
	 of vectors to which I can add, delete and traverse.

	 Who can help?

	 Valentijn van Dijk (dijk@cwi)
From: jbuck@foucault.berkeley.edu (Joe Buck)
Newsgroups: comp.lang.c++
Subject: Re: FAQ for g++ and libg++, plain text version [Revised 4 Dec 1992]
Date: 28 Dec 1992 00:30:01 GMT
Organization: U. C. Berkeley
NNTP-Posting-Host: foucault.berkeley.edu

In article <Bzs90A.6t@dcs.ed.ac.uk> tk@dcs.ed.ac.uk (Tommy Kelly) writes:
>In article <g++FAQ_12_1992_plain@ohm.berkeley.edu> jbuck@ohm.berkeley.edu (Joe Buck) writes:
>>
>>   Because the legal policies of Apple threaten the long-term goals of
>>FSF, as well as the concept of free software, no support will be lent
>>to efforts to port Gnu software to Macintosh or other Apple hardware.
>
>Where can I find out more about FSF (and OSF?), and the free software concept
>in general?

I don't want to take up a lot of space on comp.lang.c++ for this one;
I assume you don't get the gnu groups, since you removed that group from
your Newsgroups line.

For more information about the Free Software Foundation or the GNU project,
write to gnu@prep.ai.mit.edu.

The Open Software Foundation (OSF) has nothing to do with the Free
Software Foundation; it is an alliance of DEC, HP, and other companies
whose goal was to prevent AT&T and Sun from dominating the Unix
marketplace.




--
Joe Buck	jbuck@ohm.berkeley.edu
Newsgroups: comp.lang.c++
From: swk7@cbnewsk.cb.att.com (steven.w.koenig)
Subject: Undefined new and delete
Organization: AT&T
Date: Mon, 21 Dec 1992 16:22:41 GMT

If one wanted to insure that no objects of a given type were ever created
on the heap, it seems logical that one should be able to declare the
new and delete operators as private but not define them. cfront 2.1
only seems to support this if the constructors are inline. The following
example works if A and ~A are inline, but gives the following error if 
A and ~A are not inline. 

Questions:
1. Are declared but undefined new and delete operators legal C++ ?
2. If so, is this a cfront bug.


#include <stddef.h>

class A
{
public: // Functions

        A() {a=0;}
        ~A() {a=0;}

private: // Data
        int a;

private: // Functions (undefined)
        void* operator new(size_t);
        void operator delete(void*,size_t);
};

main()
{
        A aa;

        return 0;
}


// CC +d means don't expand inlines

CC  +d bug.c:
cc  -Wl,-L/ut2f/utssgs/sgen1.0/lib/C++/2.1/lib   bug.c -lC
+ /etc/preroot /ccs/native /bin/cc -Wl,-L/ut2f/utssgs/sgen1.0/lib/C++/2.1/lib /C
undefined               first referenced
 symbol                     in file
A::operator new(unsigned int)   /CCtmp/CC.10864/bug.o
A::operator delete(void*,unsigned int) /CCtmp/CC.10864/bug.o
ld fatal: Symbol referencing errors. No output written to a.out

Newsgroups: comp.lang.c++
From: hansen@pegasus.att.com (Tony L. Hansen)
Subject: Re: C++ Coroutine Class?
Organization: AT&T
Date: Thu, 24 Dec 1992 01:34:46 GMT
Summary: class process
Keywords: tasking, coroutines

From: engelsma@golden.cps.msu.edu (Jonathan Engelsma (Reid))

|> 
|>   3) In Tony Hansen's book "The C++ Answer Book" it mentions that the
|>      solution to problem 7.10 (the new and improved tasking system) does
|>      not run on a Sparc. Is this true, or does anyone have a set of diffs
|>      that will allow it to work?

< Haven't read that book so I can't comment on this.    What is the new and
< improved tasking system you are referring to?  Is that different than the
< one provided with CC3.0?  

Section 7.10 discusses how to implement a library for writing event-driven
simulations. In the process, is shows one implementation (class process)
that attempts to improve on the task library in various ways.

For one, it is almost completely portable as it is written without any
assembly language routines. It does assume that you have a single contiguous
stack which can be saved and restored. The reason it doesn't work on some
RISC machines is typically because of a separate register stack; you would
have to dip down into assembly in order to access and restore a register
stack.

The model chosen for class process is very similar to the UNIX model of
processes. The coroutine class, which inherits from class process, provides
an implementation for the virtual member function process::main(). The
coroutine is run using process::exec(). The return value from
process::main(), or the value passed to process::exit(), will be the result
from running the coroutine. A coroutine can be stopped using
process::kill(), paused using process::pause(), awaited using
process::wait(), have its priority manipulated using process::getpriority()
and process::setpriority(), and put to sleep using process::sleep().

For further information, see the book. (The code is also available via ftp
to research.att.com. Login as "netlib", use your login id as the password,
and cd to c++/answerbook.)

					Tony Hansen
			    hansen@pegasus.att.com, tony@attmail.com
				att!pegasus!hansen, attmail!tony
From: bernd@bwhwob.escape.de (Bernd Wiegmann)
Newsgroups: comp.lang.c++
Subject: Is it possible to use 'delete this' ?
Date: Sun, 20 Dec 92 15:59:48 CET
Distribution: world
Organization: Arnold Bros. (est. 1905)

Hi,

Is it possible to use 'delete this' as the last statement in a
method of a class ?

        Bernd
--------------------------------------------------------------------------
    Bernd Wiegmann                 |    e-mail:  bernd@bwhwob.escape.de
    Grauhorststrasse 15            |    Tel.:   +49 5361 33622 (voice)
    D-3180 Wolfsburg 1             |            +49 5361 33752 (data)
Newsgroups: comp.lang.c++
From: pbender@qualcomm.com (Paul Bender)
Subject: Re: Automatic conversion! Can we do this?
Followup-To: comp.lang.c++
Organization: Qualcomm, Inc., San Diego, CA
Date: Tue, 22 Dec 1992 22:33:17 GMT

In article <1h7sq8INNr7e@function.mps.ohio-state.edu>,
ren@function.mps.ohio-state.edu (Liming Ren) wrote:
> 
> I wrote a string class and overloaded  operator + to achive the function
> of strcat(). It is my understanding that the compiler will do the conversion
> from char * to string using the function I supplied. What is strange is I can
> do:
> 
> string a, b("Merry");
> a=b+" Chrismas";
> a="C" + b;
> 
> But I can't do:   a="Merry" + " Chrismas";
> The compiler complains that "pointer +pointer" and the conversion does not 
> happen. I tried to overload + with (char*, char*). The compiler did not 
> allow me. HERE is the class:
> 
> class string{
>   char *str;
>   int size;
>  public:
>   string()  {str=new char[10]; size=9;}
>   string(const char *p){ str=strdup(p); size=strlen(p);}
>   string(const string& s){str=strdup(s.str); size=s.size;}
>   ~string(){delete [] str;}
>   string& operator=(const string&s){/*body*/    }
>   friend string operator+(const string&,const string&){/*body*/}
> };
> 
> main()
> {
>   string a;
>   a="Merry" +" Chrismas";
> }
> 
> It seems to me the compiler has no clue what is going on if I supply two
> pointers. It needs at least one operand to be string to invoke the
> overloaded + on string class. Is there a way to overcome this?
> 
> 
> Merry Christmas!

First, char* is a built in type.  As such operator+(char*, char*) exists in
some sense (although it is not legal to use it).  Therefore, there is no
need for the compiler to look any further.  In addition, you cannot
overload it as you would like since it already exists.  IMHO, this is good,
since overloading these operators (+,-,*,/) in that manner (having them
return a value that is different from either of arguments) would lead to
chaos.
From: surendra@plsparc.UUCP (Surendra Goel)
Newsgroups: comp.lang.c++
Subject: possible bug in MSC7.0 ....
Keywords: Multiple Inheritence, Virtual Base Class, MSC7.0
Date: 31 Dec 92 14:53:46 GMT
Organization: Personal Library Software Inc., Rockville MD


What is wrong with these classes? Is this a bug in  MSC 7.0 compiler?
The problem is with "virtual base class". If I remove the
"virtual" keyword from the abstract base class then it does not complain.
Is anybody from Microsoft is aware of this problem?

See the error message generated by the compiler after the class listing.

---------------------------- begins here -----------------------------------

class TestBase {
  	protected:
		TestBasew();
		virtual ~TestBase();
	public:
		virtual int test() = 0;
};
class TestBase1 : virtual public TestBase {
  	protected:
		TestBase1();
		virtual ~TestBase1();
	public:
		virtual int test() = 0;
		virtual int test1() = 0;
};

class TestBase2 : virtual public TestBase {
  	protected:
		TestBase2();
		virtual ~TestBase2();
	public:
		virtual int test() = 0;
		virtual int test2() = 0;
};

class TestDer : public TestBase1, public TestBase2 {
  public:
  	TestDer() {};
	~TestDer() {;};
	int test();
	int test1();
	int test2();
};
-------------------------------------- ends here ----------------------------
cl /c test.cpp

test.cpp
test.cpp(38) : error C2248: 'TestBase::~TestBase' : cannot access 'protected' member declared in class 'TestBase'



PS: I am not aware of any restriction on protected member in the derived
class.
-- 
Surendra Goel (surendra@pls.com)
Personal Library Software, Inc.  2400 Research Blvd. Suite 350, Rockville, MD 20850   Phone: (301)926-1402
From: euamts@eua.ericsson.se (Mats Henricson)
Newsgroups: comp.lang.c++
Subject: Re: Memory allocation failures and good de
Date: 21 Dec 92 09:46:14 GMT
Reply-To: euamts@eua.ericsson.se
Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden

In article 4017@ucc.su.OZ.AU, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
#In article <720@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
#>In article <1992Dec03.135428.33868@rs6000.bham.ac.uk> pickerig@eee.bham.ac.uk (Guy Pickering) writes:
#>>
#>>My advice is add a member function isOk(), and ensure that this function
#>>only returns TRUE if all memory allocation, (or other resource use,
#>>eg opening files) was performed ok. Then you can do:
#>>
#>>  SomeObject* object = new SomeObject;
#>>  if (object->isOk() == FALSE)
#>>  {
#>>    // handle error.
#>>  }
#>>
#>
#>Unfortunately there is more to it than that:
#>
#>You cannot call pObj->isOk() until you first check to see that
#>you got any sort of object back from new.
#>
#	You can if you make isOK a static member.
#	Setting 'new_handler' seems a good idea in many programs though.

An isOK() function might want to acces some private data before deciding
if the object is OK or not, but a static function can only access static
data. I agree, though, on the setting of new_handler.

Mats Henricson
Ellemtel
Stockholm
Sweden
Newsgroups: comp.lang.c++