HDTenEightyP/NetNews huggingface dataset:
From: kmr@netcom.com (KMR)
Subject: Problems with Abstract base class and pure virtual functions.
Date: Tue, 29 Sep 92 06:55:51 GMT
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 

I could not find an answer to my problem  of abstract base class
and pure virtual functions in ARM, any help will be appreciated.

Consider the following:

class A {
    public :
	int i;
	virtual void foo1() = 0;
	virtual void foo2() = 0;
	virtual void g() {} 
};

class C : virtual public A {
    public :
	virtual void foo2() = 0;
	virtual void gG() {}
};

class B : virtual public A {
    public :
	virtual void foo1() {}
	virtual void foo2() {}
};

class D : public B, public C {
    public :
	virtual void foo2() {}
};

main()
{
    D	*bb = new(D);

    bb->i = 1;
    bb->foo1();  
    bb->foo2();  
}

When compiling the above on SUN 2.1 Cfront, the compiler fails 
informing me that D is an abstract class and thus cannot be "newed"
I can rationalize the cause of failure (though I am still not certain)
however seeing it documented and the case explianed will help.

kmr@netcom.com
Newsgroups: comp.lang.c++
Subject: Re: declare keyword, type inference
From: alanb@sdl.mdcbbs.com (Alan Braggins)
Date: 05 Oct 92 16:01:13 GMT
Organization: Shape Data (Division of EDS), Cambridge UK
In-reply-to: maxtal@extro.ucc.su.OZ.AU's message of Mon, 5 Oct 1992 07:37:08 GMT

>>>>> On Mon, 5 Oct 1992 07:37:08 GMT, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) said:

> In article <TMB.92Oct4201915@arolla.idiap.ch> tmb@idiap.ch writes:
>>
>>It's not so clear to me that in the presence of a "declare" keyword,
>>you couldn't get circular dependencies. For example, what about:
>>
>>	declare x = f(&x);

> 	This would only be legal if 
> 	int x = f(&x);
> was legal. Surely you cant initialise a variable with itself like this?

You can. Of course if f makes use of the value of x, rather than just
the address, you have a problem.

The problem introduced by C++ is overloading. Given

double f(double *x);
int f(int *x);

either of

int x = f(&x);
double x = f(&x);

makes sense for declare x = f(&x);
--
     Alan Braggins, alanb@sdl.mdcbbs.com, abraggins@cix.compulink.co.uk
Shape Data - A division of EDS-Scicon Limited.   Cambridge, UK +44-223-316673
   "Any technology distinguishable from magic is insufficiently advanced."
 "My employer does not necessarily share my views - but I'm working on it."
From: das11@jaguar.uofs.edu
Newsgroups: comp.lang.c++
Subject: Exception handling & Borland C++ 3.1
Date: 28 Sep 92 04:19:10 GMT
Organization: University of Scranton


From :        David A. Sobeski
              University of Scranton & Shared Research Corporation
              das11@jaguar.ucs.uofs.edu

Description : I am creating a generic stack package.  In this package I would
              like to use exceptions as defined by Bjarne Stroustrup in his
              book The C++ Programming Language (pg 293 - 324).

              I am using BORALAND C++ Version 3.1 for Windows.  Nowhere within
              its documentation does it mention try, throw, and catch. 
              However, if you type these words in, the editor will boldface
              them as if they are apart of the language.

              When using a throw within a class, I get the error that I can
              not define a throw in an inline function.  Also, when I put a
              try in the source, it tells me illegal syntax.

Question :    Does anyone know how BORLAND C++ handles exceptions?

Example Program:

// THIS EXAMPLE PROGRAM CREATES A GENERIC STACK WITH TWO METHODS (MEMBER
// FUNCTIONS) : PUSH and POP.  IF THE STACK IS FULL, A RANGE_ERROR EXCEPTION
// IS RAISED.

#include <stdio.h>
#include <conio.h>
#include <iostream.h>

// *** Generic Stack ***
template <class T> class STACK
{
   T     *bottom;
   T     *top;
   int   maxSize;

   public:
      // *** Constructor ***
      STACK(int sz=0)
      {
         maxSize     = sz;
         bottom      = new T[maxSize];
         top         = bottom;
      }

      // *** Destructor ***
      ~STACK()
      {
         delete [] bottom;
      }

      // *** Exception class - range_error ***
      class range_error { };

      // *** push - Puts a value on the STACK. ***
      void push(const T &val)
      {
         if ((top-bottom) >= maxSize)
            throw range_error();       // RAISE EXCEPTION
         else
            *top++ = val;
      }

      // *** pop - Removes a value from the STACK. ***
      T pop()
      {
         return (*--top);
      }
};

void main()
{
   STACK<int>   iStack(2);        // Stack of two integers

   try
   {
      iStack.push(1);
      iStack.push(2);
      iStack.push(3);             // Stack is full, raise exception
   }

   catch (STACK::range_error)
   {
      cout << "ERROR : Stack is full, can not push an element on the Stack";
   }
}
From: pjl@sparc10.cs.uiuc.edu (Paul Lucas)
Subject: Re: question about delete
Organization: University of Illinois at Urbana-Champaign
Date: Sat, 3 Oct 1992 03:55:00 GMT

In <20907@plains.NoDak.edu> heilig@plains.NoDak.edu (Zachary Heilig) writes:

>Hello again

>why does foo != NULL in the following example.  You would think that since
>I deleted foo it would be NULL, or at least still point to the same spot
>in memory, but evidentally, it doesn't even do that.  Where is foo pointing?

>Script started on Fri Oct  2 15:44:15 1992
>$ g++-2.0 test2.cc
>$ a.out
>foo = bar
>foo is not NULL after delete.
>foo = 
>$ 

>script done on Fri Oct  2 15:44:17 1992

>here's the source:

>#include <ostream.h>
>#include <string.h>
>#include <stdlib.h>

>main()
>{
>	char	*foo;
>	foo = new char[4];
>	strcpy( foo, "bar" );
>	cout << "foo = " << foo << '\n';
>	delete [4] foo;
>	if( foo == NULL )
>		cout << "foo is NULL after delete.\n";
>	else
>		cout << "foo is not NULL after delete.\n";

>	cout << "foo = " << foo << '\n';
>	return 0;
>}

*****>	delete has no obligation to affect the pointer itself; if you
	want it to be null, set it yourself.
-- 
	- Paul J. Lucas				University of Illinois	
	  AT&T Bell Laboratories		at Urbana-Champaign
	  Naperville, IL			pjl@cs.uiuc.edu
From: crandall@spock.usc.edu (Mike Crandall)
Newsgroups: comp.lang.c++
Subject: Mark Rectangle in Borland IDE?
Date: 29 Sep 1992 07:39:04 -0700
Organization: University of Southern California, Los Angeles, CA
Distribution: world
NNTP-Posting-Host: spock.usc.edu


I've got BC++ 3.1 and I'd like to ask for some help with the IDE.

I want to be able to highlight a column of text with the mouse or keyboard
(preferrably the mouse.)  For IDE, the default when you highlight with the 
mouse is for the highlighting to "wrap" across an entire line as you pull
the cursor down the screen.  I want to highlight a column, or rectangle whose
boundaries are set out by where I move the mouse.

Micrsoft's C editor has this option, as does Emacs (mark-rectangle), but
I prefer Borland's IDE because of the syntax coloring.  I want the best
of both worlds!

Borland's tech support was clueless on the matter. (He knew less about IDE
than I do, and I'm a real newbie.)  

If anyone knows of a macro template that could do this, or has a strategy for 
writing such a macro (I couldn't find any docs on setting mouse functions
with macros) I would definitly like to hear about it.
TIA for your input.

Mike C.
-- 
-----------------------------------------------------------------------------
                Mike Crandall            | "I'm NOT perfect... yet."     
            crandall@spock.usc.edu       |                        
      USC Dept. of Aerospace Engineering |                       -MacGyver
Newsgroups: comp.lang.c++
From: tpenttin@majakka.uku.fi (Tommi Penttinen)
Subject: BC++ 3.0 TDW and Windows 3.1
Date:  2 Oct 92 12:43:42 GMT
Organization: University of Kuopio, Finland

"Can't load WINDEBUG.DLL". That's what my TDW tells me when I try to debug
anything.. And I'v put WINDEBUG.DLL on the dos command path as told in a
readme file on the distribution disk. So, what's the problem? Doesn't
BC++ 3.0's Turbo Debugger for Windows work with Windows 3.1?
HELP, please! (read: any help greatly appreciated:)

+Tommi


-- 
      +---------------------------------------------+-----------------------+
 O o  +   My social-security#: 35^3fd1"q@ (coded;)  +  Tommi Penttinen      +
  _   +   ++(Tomm:)  /* Live long and prosper */    +  tpenttin@cs.uku.fi   +
      +---------------------------------------------+-----------------------+
Newsgroups: comp.lang.c++
From: geoff@netcom.com (Geoffrey Leach)
Subject: Query regarding constructor taking void (*f)(...) as arg
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Tue, 6 Oct 1992 15:43:13 GMT

Here's one for the language-lawyers in the crowd.

The following is rejected by the xlC compiler on IBM's RISC6000
under AIX 3.2.  Is it truely illegal?

void f(int a) {int b = a;}
class bar {
    public:
	bar::bar(void (*f)(...) ...) {int a = 1;}
};
main () {bar b(f,1);}

The complaint is that the constructor invocation bar b(f,1) does not
match the argument list for bar::bar.

In case you're curious, what I'm trying to do here is to construce
a type that takes a function name and a variable list of parameter types
as arguments and later executes the function.  The workaround I'm using
is to declare the function as void * and cast it as appropriate at the
time its executed.
-- 
Geoffrey Leach		geoff@netcom.com
Newsgroups: comp.lang.c++
From: pete@genghis.borland.com (Pete Becker)
Subject: Re: declare keyword, type inference
Originator: pete@genghis.borland.com
Organization: Borland International
Date: Mon, 5 Oct 1992 16:05:41 GMT

In article <23797@alice.att.com> ark@alice.UUCP () writes:
>In article <TMB.92Oct4201915@arolla.idiap.ch> tmb@idiap.ch writes:
>
>> 	template <class T> typedef Array<Array<T> > Foo;
>
>Does this buy anything over
>
>	template <class T> class Foo: public Array<Array<T> > { }
>
>?
>-- 
>				--Andrew Koenig
>				  ark@europa.att.com

	It saves not having to write constructors that forward their arguments
to the constructors for Array<Array<T> >.  Not a compelling argument...
	-- Pete

Newsgroups: comp.lang.c++
From: kkt@philabs.philips.com (Kim-Kiat Tan)
Subject: Re: NIHCL Doc's
Keywords: NIHCL
Organization: Philips Laboratories, Briarcliff, New York
Distribution: comp
Date: Mon, 28 Sep 1992 19:16:11 GMT

In article <djd.717691139@reading> djd@csg.cs.reading.ac.uk (David J Dawkins) writes:
>michiel@baan (Michiel Wories) writes:
>
>>I Just downloaded and compiled NIHCL for BC++3.1 and am now looking...
>> <stuff deleted>
>
	Where can I download NIHCL for BC++ 3.1 ?
Newsgroups: comp.lang.c++,comp.std.c++
From: dag@control.lth.se (Dag Bruck)
Subject: Re: The concept of templates considered ill designed
Organization: Department of Automatic Control, Lund, Sweden
Date: Mon, 5 Oct 1992 06:41:49 GMT

In <comp.lang.c++,comp.std.c++> pfbertra@watcgl.uwaterloo.ca (Philippe F. Bertrand) writes:
>
>It would be nice if templates could have some sort of base class derivation
>rules.  Ie instead of < class T > have <class Foo T> which restricts T to be
>a class publicly derived from Foo.

It would also be useful if you could specify for example that
"assignment must be defined for T," without tying that knowledge to a
class hierarchy; assignment is also defined for built-in types which
cannot be classified by C++ classes.

I have seen some "interesting" examples of dummy template functions
that test class relations and if a member function exists.  It
unquestionably does the trick, but is it ugly!

		-- Dag
From: shite@sinkhole.unf.edu (Stephen Hite)
Newsgroups: comp.lang.c++
Subject: Re: NIHCL Doc's
Keywords: NIHCL
Date: 29 Sep 92 02:54:20 GMT
Distribution: comp
Organization: University of North Florida, Jacksonville

In article <1992Sep28.191611.25863@philabs.philips.com> kkt@philabs.philips.com (Kim-Kiat Tan) writes:
>In article <djd.717691139@reading> djd@csg.cs.reading.ac.uk (David J Dawkins) writes:
>>michiel@baan (Michiel Wories) writes:
>>
>>>I Just downloaded and compiled NIHCL for BC++3.1 and am now looking...
>>> <stuff deleted>
>>
>	Where can I download NIHCL for BC++ 3.1 ?

Some problems I've noticed in compiling nihclbcp.zip for BC++ 3.1:

1. The readFrom and storeOn routines are not working correctly.  My
   386 freezes up in the test routine.

2. If you define MI then the test executables will go off into never-never
   land. 

...it's a good start, though.

Steve Hite
shite@sinkhole.unf.edu
Newsgroups: comp.lang.c++
Subject: Trouble compiling newmat04 with DJGPP
From: elston%boot.decnet@edwards-tems.af.mil (Mark Elston, NSI Inc., Edwards AFB CA)
Date: 5 Oct 92 11:19:41 -0700
Organization: T&E Mission Simulator - Edwards AFB, CA

OK.  I recently picked up newmat04.zip and compiled and tested it on our system
here at work (VAX VMS 5.? GNU C++ 2.2.2) and got it to compile, link and run
with very little effort (although there seems to be some kind of memory leak
that I haven't tracked down yet).  Bouyed with this success I took the package
home and compiled it (25MHz 386 MS-DOS 5.0 TC++ 3.0) and also got it to 
compile with little effort (mostly delete[amount] anachronisms).

Since all this worked so well I tried to use DJGPP (version 2.2.2).  I ran into
a big brick wall here.  It seems that in the MatrixType class operator
functions I get the error "Too many arguments in constructor".  Now, I haven't
been at the C++ game too long, nor have I had a broad base of compilers to
work with but something doesn't seem quite right.  If the GNU C++ compiler for
VMS works fine on this package and TC++ 3.0 does too then why won't DJGPP 
(which is just the GNU compiler ported to DOS) do the same?

If anyone has any ideas about this then please let me know.  I would like to 
have the 80386 code to run for comparison purposes.

----------------------------------------------------
Mark Elston
elston@edwards-tems.af.mil
From: billcat@milton.u.washington.edu (Cory Sandahl)
Newsgroups: comp.lang.c++
Subject: C++ Source Code Archives?
Date: 28 Sep 92 21:54:42 GMT
Article-I.D.: u.1992Sep28.215442.26647
Reply-To: billcat@u.washington.edu
Organization: University of Washington, Seattle

Can anyone tell me if there exists an archive of C++ source code somewhere
out there on the net?

Thanks.
    
Newsgroups: comp.lang.c++
From: rmartin@donner.Rational.COM (Bob Martin)
Subject: Re: Only 'public' stuff in .h file?
Organization: Rational
Date: Wed, 7 Oct 1992 03:51:29 GMT

mark@sdd.hp.com (Mark Overton) writes:

|I'm really hoping that C++ will let me totally hide all implementation
|info from the "user" of a class.  This means the .h file for the class
|must contain solely the public interface, and not contain any private
|members (which would be in the .cpp file).

|Is such separation of public and private members possible?


Yes, indirectly.


Create an abstract class which your class inherits from, and which
defines pure virtual functions for all the methods of your class.
Now, only the instantiator of your class needs to see its .cpp file,
all other users can deal with your class via a pointer or reference to
the abstract base, and so only need to include the .cpp file of the
abstract base.  Thus all the private and protected crud in your file
is hidden from your users.


--
Robert Martin                        Training courses offered in:
R. C. M. Consulting                       Object Oriented Analysis
2080 Cranbrook Rd.                        Object Oriented Design
Green Oaks, Il 60048 (708) 918-1004       C++
From: tmb@arolla.idiap.ch (Thomas M. Breuel)
Newsgroups: comp.lang.functional
Subject: Re: Why functional languages?
Date: 29 Sep 92 02:35:55 GMT
	<TMB.92Sep28144424@arolla.idiap.ch> <annius.717696151@freyr>
Reply-To: tmb@idiap.ch
Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
	Perceptive)
In-reply-to: annius@sif.research.ptt.nl's message of 28 Sep 92 16:02:31 GMT

In article <annius.717696151@freyr> annius@sif.research.ptt.nl (Annius Groenink) writes:

   tmb@arolla.idiap.ch (Thomas M. Breuel) writes:

   >I think in order to fulfill their promise in this area, functional
   >programming languages should probably go back to Lisp notation.

   (I
     (Don (' (t
		(think
		      (so)))))) (!).

Well, in SML, that would be:

   I(
     Don( Q( t(
		think(
		      so()))))) (bang).

That doesn't look any prettier to me.

Seriously, I somehow doubt that the "gain in readability" from putting
your parens after your function names, not having to put parens around
"let" and "if", and using infix for the occasional numerical operation
(NB, I write a lot of numerical code myself), is really worth it
compared to the difficulties such irregularities in syntax cause for
tools, tool writers, and simple-minded human readers like me. But, all
these things are a matter of taste, and I don't want to start a flame
war.

Incidentally, what SML modes for Emacs are out there? I have Lars'
mode, but it seems to get confused on occasion, and I can't get it to
give me the simple, no-frills layout that I want.

					Thomas.
Xref: sparky comp.lang.functional:1195 comp.lang.lisp:2578
From: eliot@dcs.qmw.ac.uk (Eliot Miranda;W211)
Newsgroups: comp.lang.functional,comp.lang.lisp
Subject: Re: Performance of Yale Haskell using various Lisps
Date: 4 Oct 92 16:54:07 GMT
Distribution: comp
Organization: Computer Science Dept, QMW, University of London

In <PETERSON-JOHN.92Oct2133900@sparrow.CS.Yale.Edu> peterson-john@CS.Yale.Edu (John C. Peterson) writes:

>The first benchmark is nfib, which indicates the basic speed of
>function calling and Int arithmetic.

>module Main where

>nfib :: Int -> Int
>nfib 0 = 1
>nfib 1 = 1
>nfib n = nfib (n-1) + nfib (n-2)

The above is an incorrect definition of nfib, it should be equivalent to

nfib :: Int -> Int
nfib 0 = 1
nfib 1 = 1
nfib n = nfib (n-1) + nfib (n-2) + 1


The idea is that the value returned by nfib is the same as the number of 
function calls required to compute it.  So each invocation of nfib adds one,
hence the extra '+ 1' in the last line of the correct definition.

e.g.
	nfib(3) -> nfib(3-1) + nfib(3-1) + 1 -> 1 + 1 + 1 -> 3
	Three invocations of nfib return 3.

A rough estimate of function calls per second can be derived by dividing the
value returned from some suitable invocation of nfib by the time required to
compute that value.

Its recommended that you find the invocation of nfib that takes nearest to
thirty seconds to run and use that.


Eliot Miranda,  Lecturer	email:	eliot@dcs.qmw.ac.uk
Department of Computer Science	ARPA:	eliot%dcs.qmw.ac.uk@nsf.ac.uk
Queen Mary Westfield College	UUCP:	eliot@qmw-dcs.uucp
Mile End Road, LONDON E1 4NS	Tel:	071 975 5229 (+44 71 975 5229)
				Fax:	081 980 6533 (+44 81 980 6533)
--
Eliot Miranda,  Lecturer	email:	eliot@dcs.qmw.ac.uk
Department of Computer Science	ARPA:	eliot%dcs.qmw.ac.uk@nsf.ac.uk
Queen Mary Westfield College	UUCP:	eliot@qmw-dcs.uucp
Mile End Road, LONDON E1 4NS	Tel:	071 975 5229 (+44 71 975 5229)
				Fax:	081 980 6533 (+44 81 980 6533)
Xref: sparky comp.lang.functional:1168 aus.jobs:345 misc.jobs.offered:11801
From: ajtd@honey.st-and.ac.uk (Tony Davie)
Newsgroups: comp.lang.functional
Subject: Re: Referentially transparent I/O in purely functional languages
Date: 28 Sep 92 09:48:38 GMT
Organization: St.Andrews University

> I expect that many of the people involved in the design of Haskell read this
> newgroup, so I will pose the following question to them: why doesn't Haskell
> have any support for the notion of a unique type? Was this simply never
> considered, or were there some particular reason(s)?

Perhaps someone could say something about what a'unique' type is.
Newsgroups: comp.lang.functional
From: nickh@CS.CMU.EDU (Nick Haines)
Subject: Re: Why functional languages?
Originator: nickh@VOILA.VENARI.CS.CMU.EDU
Organization: School of Computer Science, Carnegie Mellon University
	<TMB.92Sep28223555@arolla.idiap.ch> <26463@castle.ed.ac.uk>
	<BvGz2u.2rv.1@cs.cmu.edu>
Date: Fri, 2 Oct 1992 18:42:30 GMT

In article <BvGz2u.2rv.1@cs.cmu.edu> spot@CS.CMU.EDU (Scott Draves) writes:

   [about SLM syntax ...]

   but the answer to your question isn't important.  real programs aren't
   that short.  large lisp functions retain their clarity.  large SML
   functions are horrid messes.  this is taken from the compiler itself
   (something i work on).  i didn't even have to try and find something
   bad...  (* Copyright 1989 by AT&T Bell Laboratories *).

       and getroot(APP(VAR f,wl)) = (f,mix(wl,standardformals wl))

   [...etc...]

With all due respect to the NJ programmers (who have, after all,
provided us with the best free compiler) the compiler is well known
among SML hackers as one of the least legible, least well-structured
large pieces of SML code in existence. It's dying from mouldiness and
sagging under the weight of hacked-on pieces. It's _very_ difficult to
understand or maintain, but this is not a consequence of it being
written in SML. I have worked on other SML systems, at least one of
which is larger than the NJ compiler, and in comparison they are
simple, legible, and maintainable (and _commented_!).

   [...]

   where's the obvious syntax error in this:

   datatype foo = FOO of x
   fun bar FOO x = x

          (     )
Missing parens, of course; you didn't really want a curried function
of type (x -> foo) -> 'a -> 'a, did you? What's the problem? Anyone
who's done much work in SML should recognise immediately that

	fun bar x y = 

defines a curried function. The real problem with the fun syntax is
with infix functions (which IMO are a mistake in the design).

As a hacker who's worked specifically with syntax and parsing problems
in SML, I will be the first to agree that it is not syntactically
perfect. But it's problems are minor compared to a language in which
_every_ structure looks the same. I have also worked with very large
LISP systems and much prefer coding in SML.

Nick Haines nickh@cmu.edu
From: wright@gefion.cs.rice.edu (Andrew Wright)
Newsgroups: comp.lang.functional
Subject: Re: SML Pretty-printing
Date: 6 Oct 92 19:44:08 GMT
Article-I.D.: rice.BvptHK.Cop
Organization: Rice University, Houston

In article <91849@netnews.upenn.edu> freeman@linc.cis.upenn.edu (Jon Freeman) writes:
>I never even thought that writing a pretty-printer for SML was a
>feasible undertaking.  Consider the following program:
>
>--------------------------------------------------------------
>datatype foo = Alpha of int | Beta of real | Gamma of string;
>datatype bar = Happy of int | Dopey of real | Grumpy of string;
>
>fun testcase (x,y) =
>  case x of
>    Alpha _ => ()
>  | Beta _ =>
>      case y of
>        Happy _ => ()
>      | Dopey _ => ()
>      | Grumpy _ => ()
>  | Gamma _ => ();       (* Hmmm... *)
>--------------------------------------------------------------

This example is bogus.  The last line belongs to the case statment,
not the function (hence this program is not type correct).  Your
naive pretty printer would fix the misleading indentation.

Good pretty printing simply involves building a _full_ parser for the
language, choosing a canonical format for expressions, and rules for
line breaking.

The problem is that my choice of canonical format may not be yours.
ML suffers from this to a greater degree than Lisp.  But note that
Lisp/Scheme also suffers from this problem.  My scheme mode indents as:

   (and one-long-name second-long-name third-long-name fourth-long-name
     fifth-long-name)

but (sometimes) I would rather have:

   (and one-long-name second-long-name third-long-name fourth-long-name
        fifth-long-name)

In fact, the scheme mode has a list of special names and a rule about
length of names to choose between the two ways.

Andrew Wright