HDTenEightyP/NetNews huggingface dataset:
From: krc@wam.umd.edu (Kevin R. Coombes)
Subject: Re: Squares and Rectangles (Re: Const Inheritance)
Organization: University of Maryland, College Park
Date: Sat, 21 Nov 1992 01:28:16 GMT

In article <1992Nov20.012340.19437@fcom.cc.utah.edu> val@news.ccutah.edu (Val Kartchner) writes:
>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
> [ more levels omitted...]
>There would also be other branches in the 'shape' heirarchy, but this
>illustrates the principle.
>

I don't understand some of the details of this hierarchy. I particularly
don't understand how to reuse certain code. What methods does square have?
Which are overloaded in Rectangle? Which are virtual? Which data methods
do they have? For example, a Square probably has a location (specified by
its center, or its upper left, or  any convention you like) and a side length.
It should have a constraint (though these are unenforcable in the current
language---interested parties should look at A++) that keeps it square.
Some of the methods you might like to have are the ability to intersect
it with other shapes, or to display it. If you intersect two squares, the
best you can hope to get is a rectangle (I'll continue to assume the sides
are aligned, to keep things simple). Where do you put the method? Is it a
virtual method in square? A pure virtual method? What happens when you want
to intersct two rectangles? Is there any way to write this hierarchy so that
you can reuse both the code to intersect (or display) shapes and the code
to modify dimensions?

Kevin Coombes <krc@math.umd.edu>
Newsgroups: comp.lang.c++
From: kato@is.s.u-tokyo.ac.jp (Kazuhiko Kato)
Subject: Yacc++
Organization: Dept. of Info. Sci., Fac. of Sci, Univ. of Tokyo, Japan.
Distribution: comp
Date: Fri, 20 Nov 1992 07:09:05 GMT


Does anyone know the address of Compiler Resources, Inc.,
that provide Yacc++, Yacc extended with C++ integration,
Lex feature, and extended BNF.

Experience or evaluation to Yacc++ is also very welcome.

	Kazuhiko KATO
	E-mail: kato@is.s.u-tokyo.ac.jp
	Postal: Department of Information Science, Faculty of Science
                University of Tokyo 
		7-3-1 Hongo, Bunkyo-Ku Tokyo, 113 JAPAN
	Tel: +81 3-3812-2111 ext.4104 or 4095	Fax: +81 3-3818-1073

Newsgroups: cvnet.c++,comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: Finding memory leaks
Keywords: OOP,memory leaks
Organization: TauMetric Corporation
Date: Sun, 22 Nov 1992 18:19:37 GMT

mpk9172@ultb.isc.rit.edu (M.P. Kirby) writes:

>In C I used to use a memory leak finder that would help me find
>my memory leaks.  I basically created a #define for malloc that redefined
>it ...

>I would like to do the same kind of thing in C++.  Unfortunately, it
>seems that new is not as easy to #define over as malloc.  I thought
>(briefly) that I could do something like #define new new(__LINE__,__FILE__) 
> and then overload the new operator, but this causes a recursive macro.

There have been two answers to this question that completely missed
the point.  You do NOT want to replace "new" with a macro.  "new" is
a keyword which causes constructors to be called, and memory to be
allocated via the function "operator new()".  If you replace the "new"
keyword with a macro, you destroy the semantics of most programs.

You are allowed in C++ to replace "operator new()" and "operator delete()"
with your own versions.  Since these are the functions which actually do
the memory allocation, you can get any effect you want by replacing them.
(If you replace one, you should replace both, to ensure compatibility.)
You don't even have to recompile any code -- just re-link your program.
The ARM and Stroustrup 2 explain how to do this, apart from other books
and many magazine articles which also cover the subject.  It takes a bit
of explaining to cover all the subtle points which you have to consider,
so I prefer not to present just a simplistic answer here.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Newsgroups: comp.lang.c++,comp.std.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: g++ ofstream
Organization: TauMetric Corporation
Date: Fri, 20 Nov 1992 18:50:12 GMT

brianm@cc.gatech.edu (Brian N. Miller) writes:

>What flags should i check or what method shall i call
>to determine if a once opened g++ ofstream has since been closed?

I don't know how standard the g++ implementation of iostreams is.
In the usual implementation, you want the is_open() function in the
filebuf.  You can call it like this:

	ofstream mystr( ... );
	...
	if( mystr.rdbuf()->is_open() ) {
	    ... a file is open
	}
	else {
	    ... no file is open
	}
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Newsgroups: comp.lang.c++
From: kessel@eos.arc.nasa.gov (Karen Kessel)
Subject: c++ and SGI Indigo
Summary: need info on C++ development environs for Indigo
Keywords: SGI Indigo C++ programming
Organization: NASA Ames Research Center
Distribution: usa
Date: Mon, 23 Nov 1992 23:34:10 GMT



Hi, I need some information on development environments for 
the Silicon Graphic's Indigo. I've used their C++ compiler and looked
at CASEVision Workshop, but I want to know what else there is
out there.  I need to use ANSI std C++.

One thing -- I'm used to a full C++ development environment --
an editor, compiler, debugger, etc.  I've used Centerline C++
on the Sun and Borland's C++/Application Frameworks on the PC.  Is 
there anything like these in the SGI world?

Thanks,
Karen L. Kessel
kessel@eos.arc.nasa.gov
From: purves@uctvax.uct.ac.za
Newsgroups: comp.lang.c++
Subject: 3D coordinates conversion to 2D
Date: 18 Nov 92 18:41:50 GMT
Article-I.D.: uctvax.1992Nov18.164150.203294
Organization: University of Cape Town


	Could anyone please give me a hint on how to convert three dimensional 
	Coordinates so it can be displayed on a screen and look right as well.
	
	Please post to this News-Group as I am using TC++.

	Thanks.
From: jones@colisd.COLONIAL.COM (Libby Jones)
Newsgroups: comp.lang.c++
Subject: object oriented libraries
Date: 17 Nov 92 18:22:06 GMT
Reply-To: jones@colisd.UUCP ()
Organization: Colonial Management, Boston


I am posting this question for a friend.  If you have an
answer to her question please call her.  She does not yet
have any computers where she works.  Please call KitKoon Chan
at 617-434-3497.  Thankyou.

Are there any object oriented class librarys for banking and
financial applications such as an account object for a customer
account, and ATM object for ATM transactions?  Who are the vendors
of these libraries?
 
Newsgroups: comp.lang.c++
From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
Subject: Re: Self Deletion
Date: Mon, 23 Nov 1992 18:25:13 GMT
Organization: University of Birmingham

In article <1992Nov20.221751.2482@crd.ge.com>, jim@galifrey (Jim Weirich) writes:
   [...]
> The most straight forward way is have the window object delete
> itself by saying "delete this;" inside the member function handling
> the CLOSE button. This seems to work, but I wonder if it is proper to
> delete an object while executing one of its member functions.

Self deletion is not uncommon in C++ so if it's unsafe I'd be very supprised.
(Execpting of course the usual hazards with delete ;-> )
-- 
    \\   ( )    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
Newsgroups: comp.lang.c++
From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
Subject: Re: HELP:  Trouble redefining <<
Date: Tue, 17 Nov 1992 21:07:33 GMT
Organization: University of Birmingham

In article <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 << ' '); }
> -----------------------------------------
Write out your calls to ostream::operator<< in full to make your code
parseable

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

BUT it still won't (I think but I'm not sure) work as a non-member
operator<<(ps&,int) won't hide ostream::operator<<(int) and a
member ps::operator<<(int) would hile all ostream::operator<<()

If I'm right and it doesn't work then see my contribution to "Re: What's so
good about streams" (or some subject like that) for a work-round.
-- 
    \\   ( )    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
Newsgroups: comp.lang.c++
From: feathers@serss0 (Michael Feathers)
Subject: Re: Two things: typeof() and exceptions
Organization: Florida International University, Miami
Date: Mon, 16 Nov 1992 23:34:00 GMT

In article <1992Nov16.202036.1@vax1.bham.ac.uk> mccauleyba@vax1.bham.ac.uk (Brian McCauley) writes:
>
>IMHO we should always think carefully before adding a new token to
>the language after all some poor sod will have used it as a symbol.
>It would not detract from the readability to use class() instead.
>
>There is a presedent for using the token `class' in this way:
>  `template<class T>' "class" meaning "T is a symbol of type class"
>  `class(xxx)' "class" meaning "Convert xxx to a value of type class"
>


This is a great point of departure for another question: 

Why does the syntax for a template require the class keyword when templates
are instantiable to the predefined types of C++ (int, double, etc.,.)?

I suspect the reason is to disambiguate expressions and class/type names
as parameters to templates.  However, it is a wonderful start towards 
perhaps making the predefined types of C++ behave as classes.  It would
be nice to be able to inherit from int or float, for instance.  Anyone
who would want to do something like this today needs to make a class
with an int or float member.  Most compilers that I've run into still
generate code which accesses the single member like a struct even though
it is at offset zero in the struct.

What would we do for syntax?  How about this:
 
class Integer : public int
{
    public:
        operator int () { return *this; }
};

*this would be the access for the int portion of an Integer.  Note that
if there were additional members in class Integer, an int cast would have
the effect of "object-slicing" *this to only the int portion.

I'm not sure if such lvalue casting is now allowed.  All of this is off
the top of my head, but I think that making the predefined types into 
classes would certainly help the orthogonality of the language.
 
The syntax of templates certainly suggests that predefined types are
sort of like classes, doesn't it?

Newsgroups: comp.lang.c++
From: pjl@cs.uiuc.edu (Paul Lucas)
Subject: Re: Compiler Bug (AT&T 2.1) ?
Keywords: declaration constructor
Organization: University of Illinois at Urbana-Champaign
Date: Tue, 17 Nov 1992 22:35:45 GMT

In <1992Nov17.181306.8081@lut.ac.uk> J.March@lut.ac.uk writes:

>Consider this:

>                ______ start file.c _______
>class Elt
>{
>public:
>                Elt(int*);
>                Elt(const Elt&);
>                Elt& operator=(const Elt&);
>                ~Elt();
>};



>class List
>{
>public:
>                List();                                 
>                List(const Elt&);
>                List(const List&);
>                List& operator=(const List&);
>                ~List();
>};


>void main()
>{
>        List L(new int(1));
>}


>                ______ end file.c _______

>compiled with:

>        CC +w file.c 

>to give:

>ld: Undefined symbol 
>   Elt::Elt(int*) 
>   List::~List()  
>   Elt::~Elt()   
>   List::List(const Elt&) 
>Compilation failed

>Fair enough,

>BUT:  Shouldn't this fail because the declaration of L doesn't match any of 
>        the constructors for class List?


*****>	But List knows it can make an Elt const& from an int*, so "no."
-- 
	- Paul J. Lucas				University of Illinois	
	  AT&T Bell Laboratories		at Urbana-Champaign
	  Naperville, IL			pjl@cs.uiuc.edu
From: collins@emperor.gatech.edu (Tom Collins)
Newsgroups: comp.lang.c++
Subject: Re: ProtoGen from Borland
Date: 16 Nov 92 14:41:56 GMT
Organization: CERL-EE, Georgia Institute of Technology

In article <Bxo9vo.KCx@usenet.ucs.indiana.edu> ezachris@cochiti.ucs.indiana.edu writes:
>Borland's offering the ProtoGen code generator for just $49.90.
>Does anbody know anything about this?
>Is it worth spending fifty bucks for?

I can't pretend to be an authority on ProtoGen, but I did get a free copy
with my Borland C++, and I played with it a bit.  Here's how one typically
uses it:
  - You still use Resource Workship, Whitewater Toolkit, Microsoft SDK,
    or whatever is your favorite resource editor, at least for icons,
    dialog boxes, and miscellaneous bitmaps.
  - You can design menus in either ProtoGen OR your resource editor.  Why?
    Because ProtoGen works by letting you start with a main application
    window, define a menu, connect dialog boxes to menu items, submenu
    items, and buttons in other dialog boxes, until you have your basic
    application framework (i.e., if you use Protogen, it makes sense to
    design the menus inside it, but you don't have to -- and if you
    load other menus later, you presumably would use your resource editor).
  - You also perform some other basic operations in ProtoGen, like defining
    the background color of the main window and connecting an icon to the
    app.
  - You may test the flow of the application within ProtoGen.  When you're
    happy, you generate code, which you may compile without leaving, if
    you like.  The code can be either C or C++ (your choice), and it
    includes ObjectWindows calls for the Windows functions.  The code
    has all of the appropriate gaps for you to fill in with the stuff 
    which makes it really do something.  If you run the "empty" version
    generated by ProtoGen, it acts just like it does when you test the
    application flow inside ProtoGen.
  - You are supposed to be able to keep using ProtoGen after you've
    added code, if you follow the rules.  
   
My gut feeling is that I'm going to like ProtoGen for applications with
fairly straightforward user interfaces.  I find it tedious to get over
the hump when starting a new application from scratch, and ProtoGen
seems to do the busy work.  Whether or not it makes sense for an application
which starts simple but eventually loads other menu resources and makes
use of the multiple document interface, etc. -- I don't know.

-- 
Tom Collins                               tom.collins@ee.gatech.edu
Georgia Institute of Technology           (404) 894-2509
400 Tenth St. NW, CRB 384
Atlanta, GA  30332-0540
From: jbn@lulea.trab.se (Johan Bengtsson)
Newsgroups: comp.lang.c++
Subject: Re: Should I use a generic object which all others inherit from
Date: 20 Nov 92 11:39:47 GMT
Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
X-Newsreader: Tin 1.1 PL4

cshaver@informix.com (Craig Shaver) writes:
: In article <5232@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
: >cshaver@informix.com (Craig Shaver) writes:
: >: In article <3762@news.cerf.net> hlf@nic.cerf.net (Howard Ferguson) writes:
: .......   blah blah blah
: >: performance go all the way and use the tree approach as pioneered by
: ........  blah blah blah
: >: 
: >: 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.
: 
: >
: >If I go for the tree approach, with a base class MyObject inherited
: 
: YourObject is worthless, just use MyObject....

Yes, but from my point of view... (:-)

: >by all my classes, how am I going to reuse _your_ classes, which all
: >inherit from class YourObject?  Multiple inheritance?  What
: 
: Use delegation instead of MI ...

OK, that works (I won't mention performance).

: >How do I reuse tree-type libraries from several sources, each with
: >it's own base class protocol?
: 
: You don't!  C++ bites it bigtime because of a lack of the one thing
: that would really make it good -- a standard base class library.

Agreed, but you may want to use a few non-standard but nevertheless
good libraries.  Besides, standards are relative things.  You don't
always need to adhere to worldwide standards, sometimes standard
libraries within a corporation is enough.  Easy combination of the
corparations standard libraries with commercial libraries is an import
issue, I imagine.

: >Enforcing a common protocol (by inheritance) for all your classes,
: >_hampers_ reuse of your classes by anyone except yourself.
: 
: Hold on there pardner!  Start your own branch if you don't like mine.
: Trim the damn tree, make sure you have access to all source for classes.

Yes, if you are prepared to use the old hack-it-in-the-editor approach
to reuse, then sure, no problem.  Updates of the reused classes will
be a pain to handle for you.  Being able to reuse without source
code changes to working code is a major advantage of O-O languages.
Do you want to throw that away?

: This statement sounds bogus.  What is your point?

Let others work for you.  Reuse without touching their code, even
if you have it (bugs aside).

: >Once a reference to an object has been passed as a generic
: >object reference, for example into a collection, how do you (safely)
: >call the actual methods of the objects (derived) class?

You didn't answer on that one...

-- 
--------------------------------------------------------------------------
| Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
| Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
--------------------------------------------------------------------------
From: SASTPH@vm.sas.com
Newsgroups: comp.lang.c++
Subject: Diagnostic Message Class?
Date: 16 Nov 92 13:49:12 GMT
Organization: SAS Institute Inc.

Some weeks ago a C++ journal containing an article on how to construct
a diagnostic message class crossed my desk.  I skimmed the article and
passed the journal on.

Alas, now I need the article but I can't find the journal, and worse,
can't even remember its name!  All I can remember is that the issue
was fairly recent (within the past one or two months) and that it was
printed on slick paper.

Does this ring a bell with anybody?  If you know what article it was
I'd appreciate an e-mail reference.  Failing that, if you've got some
ideas on how to implement a good class for issuing formatted diagnostic
messages, I'd be happy to hear them!

Thanks in advance!
Newsgroups: comp.lang.c++,comp.std.c++
From: jimad@microsoft.com (Jim Adcock)
Subject: Re: something nasty report
Date: 17 Nov 92 01:38:39 GMT
Organization: Microsoft Corporation

In article <5798@npg-sd.SanDiegoCA.NCR.COM> rns@npg-sd.SanDiegoCA.NCR.COM (Rick Schubert) writes:
|In <BxIp1L.M37@unx.sas.com> sasghm@theseus.unx.sas.com (Gary Merrill) writes:
|
|>When a compiler dies with an internal error, causes an access
|>violation, etc. it is *always* a bug.
|
|Not *always*: if the internal error is caused by an error in the program
|being compiled, it is merely a very user-unfriendly error message (I
|consider "segmentation violation -- core dumped" to be the ultimate
|diagnostic).

I'd say you're both right -- because a "bug" is any failure to meet
customer expectations.  In the case of the "C" standard it is quite
"legal" for a compiler to crash when fed an erroneous program --
as long as it emits some kind of warning or error message before during
or after its death.  Whether or not this meets customer expectations
or not is not a "legal" issue.  [In the case of the "C++" standard there
isn't so who can say?]  Personally, I hate compilers that die without
an applicable line#, such that I have to debug by binary chop.  But, I
have yet to find any compiler where it is not easy to construct 
erroneous input such as to kill the compiler horribly.  A better measure
is whether or not beginning programmers frequently write erroneous programs
that invoke such horrible deaths.  Once people begin to understand the language,
they tend to exercise these truly exceptional paths [partway;-] through 
the compiler less often.

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: Thu, 19 Nov 1992 17:33:05 GMT

In article <1992Nov13.053142.1218@BofA.com> dan@BofA.com (Dan Brockman) writes:
>
>IMHO C++ is just one more modular language in this respect, sales pitches
>notwithstanding.  FORTRAN made "software components" realizable in the 50's.
>

	Subroutine libraries are not in the same 'class' as class libraries.
C++ is at leat one ( I reckon 2 ) orders of magnitude 'better' than
Fortran. Although classes can have bugs, once these are iron out
the compiler does a good job of ensuring you cannot *misuse* the class
as easily as you can incorrectly sequence a series of function calls
or mix up the parameters.

	Compare even C strings (you can have all the functions you
want but as far as Ican see you are always writing assembler) with 
C++ strings (with constructors and destructors to automate
storage management).


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
Newsgroups: comp.lang.c++
From: mat@mole-end.matawan.nj.us
Subject: Re: Template functions as class members
Summary: No templates as member functions, sorry.
Organization: :
Date: Sun, 22 Nov 1992 19:15:02 GMT

In article <1ej5hqINN1lb@cardamom.compnews.co.uk>, rogera@compnews.co.uk (Roger Allen) writes:
> ... is it possible to have template functions as class member functions?
> I've tried it ... but it complains at the syntax ... I sat and pondered
> this and can't think why this shouldn't be possible.

Sorry, no, you can't.  But remember that every member function of a template
class IS a template.

Oh, why not?  Well, for one thing a user can provide an explicit version
for any templated function.  Since the member function has access to the
class's private parts, this would allow anyone to write a function that
would violate encapsulation without any changes to or actions with the
class header.

Think about it.
-- 
 (This man's opinions are his own.)
 From mole-end				Mark Terribile

 mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ