HDTenEightyP/NetNews huggingface dataset:
From: val@news.ccutah.edu (Val Kartchner)
Subject: Re: Squares and Rectangles (Re: Const Inheritance)
Organization: University of Utah Computer Center
X-Newsreader: Tin 1.1 PL3
Date: Fri, 20 Nov 92 01:23:40 GMT

In article <721507350snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk writes:
>In article <1992Nov4.165028.1273@wam.umd.edu> krc@wam.umd.edu (Kevin R. Coombes) writes:
>> From a mathematical point of view, there is no question about the
>> relationship that should hold. Every rectangle IS-A polygon, with
>> four sides and four right angles. Every square IS-A rectangle with
>> four equal sides. 

>I think our problem here is that we have two separate meanings of "is-a".
>In the geometrical sense, any particular Square "is-a" Rectangle.

The mathematical heirarchy is inverted for OO.  Perhaps the "is-a" relationship
should be "is-a-...-with-additions".  For example:

	shape		// Abstract base class
	   ^
	   |
	square		// base class
	   ^
	   |
	rectangle	// a square with both dimensions adjustable
	   ^
	   |
	parallelogram	// a rectangle with an adjustable angle
	   ^		// (The other angle is derivable.)
	   |
	quadrilateral	// a parallelogram with three sides adjustable
	   ^		// (The fourth side is determined by the one angle.)
	   |
	polygon		// a quadrilateral with number of sides adjustable
	   ^		// (This also complicates the angles.)
	   |
	something	// a polygon where "sides" don't have to be straight
			// lines  (This really complicates things.)

There would also be other branches in the 'shape' heirarchy, but this
illustrates the principle.

			-=:[ VAL ]:=-
--
|================== #include <disclaimer.h> ==================///=============|
| "AMIGA: The computer for the creative mind" (tm) Commodore /// Weber State  |
| "Macintosh: The computer for the rest of us"(tm) Apple \\\///   University  |
|== "I think, therefore I AMiga" -- val@csulx.weber.edu ==\///= Ogden UT USA =|
Newsgroups: comp.lang.c++
From: pjl@cs.uiuc.edu (Paul Lucas)
Subject: Re: Is Ctor X() required for the object of class X to be able to be dynamically allocated?
Keywords: constructor X(), dynamic allocation
Organization: University of Illinois at Urbana-Champaign
Date: Wed, 18 Nov 1992 22:54:12 GMT

In <BxxC3p.Btn@math.uwaterloo.ca> xjzhu@math.uwaterloo.ca (Xiaojun Zhu) writes:

>Q: Is it necessary to have a constructor which took no argument in order
>   for the object of a class to be able to be dynamically allocated?

>More specifically,  I have a class X, when I can say

>X *x=new X[10] ?

>Is it required that class X have a constructor X()?

>I had some experience with TC++(V1.00) which seems that X() is
>required. Anybody has any experience? Why or why not such a ctor
>is needed?

	Yes it is needed, but you don't have to define it unless you
	define a different c'tor yourself; the compiler will generate
	it for you unless you have const or reference data members or
	your base class(es) does(do) not have a default c'tor(s).
-- 
	- Paul J. Lucas				University of Illinois	
	  AT&T Bell Laboratories		at Urbana-Champaign
	  Naperville, IL			pjl@cs.uiuc.edu
Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Criticisms Wanted
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Mon, 16 Nov 1992 14:26:36 GMT

In article <24194@alice.att.com> bs@alice.att.com (Bjarne Stroustrup) writes:
>
>
>maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes
>
> > 	Well, Eiffel has class invariants, and these go some way towards
> > providing semantics. Apparently quite a lot of errors in Eiffel are 
> > caught by invariant failures, such errors cannot be trapped by the
> > system in C++ because it doesnt have invariants (or post/pre-conditions).
>
>Note that assertions and invariant checking are old techniques and can
>be applied in C++. C programmers have used the assert macro for more
>than a decade and many C++ programmers use a some invariant checking
>technique. For example, see sec12.2.7 (pp416-420) of ``The C++ Programming
>Language (2nd edition).''

	Making C++ equivalents requires manual enforcement of
idioms. It is not so easy I think, for example, to implement
preconditions for functions, since the precondition ought to
be checked at the point of call, not on entry to the caller.

	It is perhaps premature to standardise the nice A++ syntax,
but it is worth looking at. I feel lack of invariants/logic
(somewhat compensated for by exception specifications) and GC
are the two major defects of C++ cf Eiffel.

	There is probably no hope for GC, but a proper assertional
facility should be introduced at some stage. Note that preconditions,
for example, are really just 'extra-strong' typing, i.e. within
the current philosophy of C++.

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.c++
Subject: Re: RUN TIME ARRAY INDEX ERRORS
Date: 19 Nov 1992 18:16:15 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <1992Nov19.102258.4237@alchemy.chem.utoronto.ca> mbersohn@alchemy.chem.utoronto.ca (M. Bersohn) writes:
>     My question to ask you is this: How did C survive all these
>years without such an obviously essential feature? How was
>anybody able to construct programs of 100,000 plus lines of C
>that worked well,without this feature? I'm a naive programmer;
>there is some magic there that escapes me.

Your naivete is in assuming that all the hundreds of thousands of lines of
C code out there work properly.  Many standard Unix commands, for instance,
will screw up badly if given too much input, for instance (there was an
article in CACM a year or so ago that demonstrated the results of giving
random input to various Unix commands -- it wasn't very pleasant).  The
Internet worm took advantage of a lack of bounds checking in the finger
server (it used gets(), which doesn't have a buffer size parameter).

But the practical answer to your question is that the reason most C
implementations don't do array bounds checking is performance.  And the
reason it isn't as big a problem as it might be is that it's not really
that hard to keep from accidentally going outside an array.  You don't need
to check before each array operation (as a simple bounds checker (such as
one implemented by overloading operator[]) would), but only when setting
the index variable.  Often you can take advantage of invariants so that you
know that the index is valid; for instance, in the code

int my_array[ARRAY_SIZE], i;

for (i = 0; i < ARRAY_SIZE; i++)
    my_array[i] = f(i);

it's not necessary to do bounds checking on each assignment, since the loop
is constructed so that it can't exceed the array bounds.  A good optimizing
compiler might be able to infer this and leave out bounds checks, but it's
a difficult optimization to implement.

Also, if you use the right library routines, (e.g.  fgets() rather than
gets(), strncpy() rather than strcpy() when copying between different-sized
arrays) you get automatic checking there.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Newsgroups: comp.lang.c++
From: pjl@cs.uiuc.edu (Paul Lucas)
Subject: Re: HELP: Trouble redefining <<
Organization: University of Illinois at Urbana-Champaign
Distribution: usa
Date: Tue, 17 Nov 1992 22:32:34 GMT

In <1992Nov17.162531.23815@cc.gatech.edu> brianm@cc.gatech.edu (Brian N. Miller) writes:

>Hello, i'm working on a C++ PostScript generator.

>I want to redefine the << operator for a class derived from ostream such that
>it appends a ' ' after outputting any int.

>BROKEN CODE   (Help me fix it...)
>-----------------------------------------
>class ps : private ostream {};

>ps &operator<< (ps &x, int i) { return (ps&) (ps ostream::<< i << ' '); }
>-----------------------------------------

	ps_stream& operator<<( int i ) {
		return ostream::operator<<( i ) << ' ';
	}

	You don't need and ps& argument (just look at the declaration for
	ostream::operator<<().
-- 
	- Paul J. Lucas				University of Illinois	
	  AT&T Bell Laboratories		at Urbana-Champaign
	  Naperville, IL			pjl@cs.uiuc.edu
Newsgroups: comp.lang.c++,comp.lang.c,comp.os.msdos.programmer
From: hykok@nyx.cs.du.edu (Herbie Husker)
Subject: Re: Poll : Microsoft support on the Internet
Organization: University of Denver, Dept. of Math & Comp. Sci.
Distribution: usa
Date: Mon, 16 Nov 92 20:48:30 GMT

I will definately support Microsoft Corp. to give tech. support via internet.
Please keep me posted on the latest count.

                               Hon-Yin dude.
                               -------------


                                                           ((,,,,,))
Greetings from Nebraska - Land of the Cornhuskers!          ( o o )
---------------------------------------------------------oOO-( v )--OOo-------
Hon-Yin, KOK                                                  U U  
University of Nebraska-Lincoln, Lincoln, NE 68588, U.S.A.                     
E-Mail: hkok@cse.unl.edu | hykok@nyx.cs.du.edu | elen003@crcnve.unl.edu
------------------------------------------------------------------------------
From: rogera@compnews.co.uk (Roger Allen)
Newsgroups: comp.lang.c++
Subject: Template functions as class members
Date: 20 Nov 92 16:59:38 GMT
Organization: Computer Newspaper Services, Howden, UK.
NNTP-Posting-Host: bay.compnews.co.uk
X-Newsreader: Tin 1.1 PL4

Forgive me if this has been mentioned before but is it possible to have template
functions as class member functions? I've tried it in Borland C++ V3.1 but it
complains at the syntax (I've successfully used the function outside of
the class scope). I sat and pondered this and can't think why this shouldn't
be possible.

Thanx in advance
--
Roger S Allen
Reply via email not encouraged.
Newsgroups: comp.lang.c++
From: cshaver@informix.com (Craig Shaver)
Newsgroups: comp.lang.c++
Subject: Re: Should I use a generic object which all others inherit from
Date: 17 Nov 92 19:08:21 GMT
Organization: Informix Software, Inc.

In article <3762@news.cerf.net> hlf@nic.cerf.net (Howard Ferguson) writes:
>I am working on the early stages of design on an embedded C++
>project. One of the decisions which we will have to make in the
>near future is whether to make all of the objects inherit from 
>onie generic object at the top of the tree or to go for the forest 
>approach. 
>
.................
>
>
>		Many thanks,
>			hlf

An embedded system!  C++!?  JUST USE C!!!!

UNLESS ....

You have some of the benefits of OOP in mind, such as inheritance, reuse, 
and information hiding.  Then if you are willing to take small dings in
performance go all the way and use the tree approach as pioneered by
Smalltalk.  I recently saw a review of the toy code that comes with the
borland compiler.  The article's author commented that the tree type
libraries were "passe" because of templates.  What a stupid thing to say!

One of the big wins of OOP is reuse.  By using an inheritance structure
you can reuse existing code and do incremental development.  Related and
unrelated classes can be used in the same context where a similar protocol
is enforced.  

I have to think some of the people involved with C++ have no idea what the
basis of OOP really is.  They are simply using C++ as an improved C.

Craig ...

-- 
Craig Shaver  (cshaver@informix.com for now) (415)390-0654 (415)926-6407
Productivity Group POB 60458 Sunnyvale, CA  94088
Xref: sparky comp.lang.c++:16803 gnu.g++.help:1481 gnu.gcc.help:2585
From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott)
Newsgroups: comp.lang.c++,gnu.g++.help,gnu.gcc.help
Subject: Passing pointers as references-to-pointers?
Keywords: reference,pointer
Date: 23 Nov 92 22:36:25 GMT
Followup-To: comp.lang.c++
Organization: Center for Computer Music Research and Composition, UCSB

Putting aside whether or not this is good practice, should the following code
work?

class BaseClass;
class DerivedClass;	// assume this is derived from the former

typedef BaseClass * &BasePtrRef;	// reference-to-pointer type

void fun1(BaseClass *b) {
	// whatever
}

void fun2(BasePtrRef bpr) {
	fun1(bpr);	// passed down as if a regular pointer
}

main() {
	DerivedClass *dc = new DerivedClass;
	fun2(dc); // passing pointer-to-Derived as reference-to-pointer-to-Base
}

In g++ 2.2.2, using gdb to check the code, the internal structure of the
BaseClass portion of dc (including the virtual function table) does not survive
being passed into fun1.  The address of the pointer is the same, but the 
contents are wrong.  Now, this might just be a gdb problem, or a g++ bug, but 
I wanted to just verify that I should expect any operation on 'b' in fun1 to 
work, assuming those operations are defined for BaseClass.

Am I missing some detail, or should this work?

Thanks!
-- 
Douglas Scott                              (805)893-8352
Center for Computer Music Research and Composition
University of California, Santa Barbara
Internet: (NeXTMail ok)   <doug@foxtrot.ccmrc.ucsb.edu>
Newsgroups: comp.lang.c++,comp.std.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Proposal - enhancement for switch statement.
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Thu, 19 Nov 1992 16:39:44 GMT

In article <1992Nov16.213015.1@vax1.bham.ac.uk> mccauleyba@vax1.bham.ac.uk (Brian McCauley) writes:

>
>Now (as promised) why ranges would be unnecessary (following the "if you
>can do it with a class then don't extend the language" rule ;-) )
>
>template <class T> class Range {
>  T top,bottom; 
>public:
>  Range(t,b) : top(t),bottom(b) {} 
>  int operator==(T t) { return bottom <= t && top >= t; }
>}
>template <class T> inline operator == (T& t,Range<T>& r) {return r == t;}
>
>switch (i) {
>  case Range<char>('0','9') : case '-' : {/*...*/} break;
>}

	This is illegal. 
	The 'argument' of a case must be a constant expression.
	switch is a primitive operation, the compiler must be able to
	check for duplicate cases.

>
>compare:
>
>switchc (i) {
>  case '0'...'9' , '-': /*...*/
>}

	Much nicer :-)
>
>OK so it's not as concise as your form but it far more C++. Assuming your
>compiler supports inlining it can be made to optimize as well as the
>explicit range syntax.
>
>BTW heres a new constuct (my mother's favorate in BASIC) that would become
>available:
>
>switch(TRUE) {
>  case expr1: { /* code */} break;
>  case expr2: { /* code */} break;
>  delfault: {/* code */}
>}
>
>-- 
>    \\   ( )    No Bullshit!     |  Email: B.A.McCauley@bham.ac.uk   
> .  _\\__[oo        from         |  Voice: +44 21 471 3789 (home)
>.__/  \\ /\@    /~)  /~[   /\/[  |    Fax: +44 21 625 2175 (work)
>.  l___\\      /~~) /~~[  /   [  |  Snail: 197 Harborne Lane,
> # ll  l\\    ~~~~ ~   ~ ~    ~  |         Birmingham, B29 6SS, UK
>###LL  LL\\   (Brian McCauley)   |   ICBM: 52.5N 1.9W


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
From: jhosee@zeus.calpoly.edu (Jeffrey Yang Ho-See [Ho! Now I See!])
Newsgroups: comp.lang.c++
Subject: Technical Support (Buying BC++)
Date: 18 Nov 92 14:41:39 GMT
Distribution: usa
Organization: California Polytechnic State University, San Luis Obispo


HI! Well I decided to go ahead and buy a Borland C++ compiler. So I stopped
into the computer center on campus today to check out the price.
200 bucks!! Wow that has got to be some deal for BC++ 3.1 w/ AF !!
I thought "whats the catch?". Sure enough on the box, I saw
EDUCATIONAL RESALE ONLY (or something to that effect) and the
following note : Borland Technical Support not offered.
WIs technical support that o,[ important? WhatIf I had Borland Tech Supp.
could I get tjhem to debug my programming assignments?
:) Also, is there any difference in Educational Versions of software
compared to commercial ones? Or it depends upon each product?
Thanks!

- Jeffrey
From: isc30092@nusunix1.nus.sg (CHOO GING YANG)
Newsgroups: comp.lang.c++
Subject: C++ or Motif or X ?
Date: 22 Nov 92 06:28:58 GMT
Organization: National University of Singapore
X-Newsreader: TIN [version 1.1 PL6]


hi netters ....

	I encountered a very strange error recently.

	I ran into a runtime error when I was on a Silicon Graphics Indigo 
	using C++ 2.1.1, X11R4 and Motif.  After much tracing, I discovered 
	the Motif "XmStringCreateSimple" routine was giving the segmentation 
	fault message.

	I later ported the SAME program over to a Sun Sparc 2 using C++ 2.1, 
	X11R5 and Motif. it ran smoothly.  Anybody out there encounter any 
	similar problem?  

cgy@kris.iscs.nus.sg
Newsgroups: comp.lang.c++
From: gerke@acs.ucalgary.ca (Ken Gerke)
Subject: Stroked Fonts for Borland C++
Date: Thu, 19 Nov 92 22:14:43 GMT
Organization: ACS
Followup-To: comp.lang.c++

Borland has a little extension for it's compiler that handles C++, but
they make it available via compuserv.  Is there an alternate site on 
the internet where utilites/extensions related to Borland C++ are
collected?
Newsgroups: comp.lang.c++,comp.lang.c
From: woyansky@flamingo.ece.cmu.edu (George J. Woyansky)
Subject: Re: other BGIs wanted
Originator: woyansky@flamingo.ece.cmu.edu
Keywords: bgi
Reply-To: woyansky@flamingo.ece.cmu.edu (George J. Woyansky)
Organization: Electrical and Computer Engineering, Carnegie Mellon
Distribution: na
Date: Sun, 22 Nov 1992 19:35:50 GMT


|> 
|>    I am using Borland C++, and need to get my hands on some other BGI graphics
|> drivers.  Namely modes that give me 256 colours.  I can handle up to 
|> 1024x768x256.
|> 
|>    I already have the ibm8514, but that is not sufficient.
|> 
|> Driss Zouak
|> dzouak@watserv1.uwaterloo.ca  
|> 

There's a bunch of borland support routines available by anonymous ftp from
wuarchive.wustl.edu in the mirrors/msdos/borland and/or
mirrors/msdos/turbo-c directories.

-George Woyansky
 ECE Dept., Carnegie Mellon University
 Pittsburgh, PA  15213
Date: Sun, 15 Nov 92 09:01:00 +0100
From: Gilles_Kohl@spam.fido.de (Gilles Kohl)
Subject: Re: Operator -> cannot return non-class types?
Newsgroups: comp.lang.c++
X-Comment-To: (Daniel Larsson)
Organization: This origin line is inoperative. Call support at 

 > Yesterday, I tried HP's new C++ compiler (3.0) and templates for the
 > first time. To my surprise, I noticed that operator -> can only return the
 > following
 > three types:
 >    - a pointer to a class,
 >    - a class, or
 >    - a reference to a class.

 > What is the rationale behind this restriction? I couldn't find anything
 > in C++PL 2nd ed. that mentions this restriction, although I didn't look too
 > hard.
Daniel,

I think the following on page 594 of C++PL2 applies:

r.13.4.6 Class Member Access

(...) An expression x->m is interpreted as (x.operator->())->m for a class 
object x. It follows that operator-> must return either a pointer to a class or 
an object of or a reference to a class for which operator->() is defined. 
operator->() must be a nonstatic member function.

---
Newsgroups: comp.lang.c++
From: draper@ais.org (Patrick Draper)
Subject: Re: Wanted: Red-Black Trees
Organization: UMCC
Distribution: usa
Date: Mon, 16 Nov 1992 22:30:26 GMT

Is there a variant of RB trees that is suitable for a disk based database
system? Are the B* or B+ trees the only efficient choices for disk based
indices?


------------------////////////////////\\\\\\\\\\\\\\\\\\\\------------------
| Patrick Draper           Disclaimer:  I can't control my fingers,        |
| draper@umcc.ais.org                   I can't control my toes! - Ramones |
| University of Michigan Computer Club                                     |
NO CARRIER                     We are a nation of laws, not people         |
------------------\\\\\\\\\\\\\\\\\\\\////////////////////------------------
From: georgef@microsoft.com (George Forsman)
Subject: Re: Poll : Microsoft support on the Internet
Date: 23 Nov 92 05:31:08 GMT
Organization: Microsoft Corporation

In article <1992Nov20.153455.3220@htsa.aha.nl> eduard@htsa.aha.nl (Eduard Beijnes) writes:
>It would be real nice of Microsoft to go to the internet,
>especially for bug reports !!! (they also can mail fixes )
>
Any MS-DOS bugs reported in the MS-DOS groups here will at least be looked at.
If they are real, they will be placed in the bug tracking system.  Getting a
response depends on how much time myself or whoever else sees it has to spare
and getting a fix is very unlikely. Microsoft does not release little fix
releases for individual bugs, so any fixes will have to wait until either a
corrective rev is made, or until the next release.


--
George Forsman|georgef@microsoft.com  | "I know that you think you understand
MSDOS Support |uunet!microsoft!georgef| what you thought I said, but I am not
--------------------------------------| sure you realize that what you heard
Disclaimer: Ask me! I'll deny it!     | is not what I meant."
Disclaimer^2: The statements in this message are my own, not Microsoft's.


Newsgroups: comp.lang.c++,comp.sys.mac.programmer
From: gtall@ogre.cica.indiana.edu (Gerry Allwein)
Subject: Re: Is anyone using MacApp for serious development?
Organization: Indiana University
Date: Fri, 20 Nov 1992 11:38:16 GMT

Yes, there are serious developers using MacApp. We are using it for Hyperproof
(I know, I know...the Universe recognises Hyper as being patented for 
HyperCard, but we're logicians and we don't care) which is an interactive
symbolic logic proof system where diagrams
are brought up to the same formal level as first order logic and one uses
both in a proof. I noticed that StrataVision, which is a drawing/rendering/
animation program was developed using MacApp. MacApp does something for us
we were loathe to go to the expense to produce ourselves, namely the basic
functions of Mac applications so they properly adhere to the Mac Thought
Police guidelines. The basic maxim is that if you do a little work, you get
a little sophisticated application. If you want a lot of sophisticated
application, you get to do a lot of work. But at least you don't have to do
a lot of work to get a little sophisticated application.

Gerry

Newsgroups: comp.lang.c++,comp.std.c++