HDTenEightyP/NetNews huggingface dataset:
From: je@unix.brighton.ac.uk (John English)
Newsgroups: comp.lang.c++,comp.object
Subject: Re: Pros and cons of C++
Date: 12 Jan 93 09:54:30 GMT
Organization: University of Brighton, UK

ccw@prefect.cc.bellcore.com (wood,christopher) writes:
: ANSI function parameters, and parameter type checking are valuable. 
: And declarations within a block, not just at the beginning, and
: assignment declarations (e.g. int count = 0;) are also an improvement
: over plain C.  And I like function name overloading and user-defined
: operators.

Umm... parameter type checking (i.e. function prototypes) are in ANSI C,
and "assignment declaration" has always been in C.
-- 
-------------------------------------------------------------------------------
John English			| Fudd's first law of opposition:
Dept. of Computing		|    If you push something hard enough, it
University of Brighton		|    *will* fall over.
E-mail: je@unix.brighton.ac.uk	| Testlicle's deviant to Fudd's law:
Fax:    0273 642405		|    What goes in, must come out.
-------------------------------------------------------------------------------
From: tmb@arolla.idiap.ch (Thomas M. Breuel)
Newsgroups: comp.lang.c++
Subject: Re: feedback wanted on appropriate OOPL
Date: 13 Jan 93 01:33:58 GMT
	<TMB.93Jan10170408@arolla.idiap.ch> <1993Jan10.220917.22879@netcom.com>
	<TMB.93Jan11010738@arolla.idiap.ch> <rmartin.726795534@thor>
Reply-To: tmb@idiap.ch
Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
	Perceptive)
NNTP-Posting-Host: arolla.idiap.ch
In-reply-to: rmartin@thor.Rational.COM's message of Mon, 11 Jan 1993 23:38:54 GMT

In article <rmartin.726795534@thor> rmartin@thor.Rational.COM (Bob Martin) writes:

   |C++ will either adapt by mandating more runtime
   |checks (integer overflow, pointer checks, garbage collection),

   Probably through the agency of class libraries which provide these
   runtime checks transparently.

   Certainly vector bounds checking and arithmetic exception testing can
   all be encapsulated within classes.

Sure they can. However...

   This I doubt.  I think it is more that some runtime features are
   expensive, period.  Languages that support them, have made a different
   tradeoff than that made in C++, and have sacrificed something else
   (probably speed) thereby.

 ... if you do a little experimentation, I'm sure you'll find, as
others have, that providing arithmetic exceptions, array bounds
checking, and garbage collection "encapsulated in classes" is much
less efficient than if they are compiler built-ins (not to mention
issues of compatibility and portability).

That is, in C++, you get "unsafe, but fast", and "safe, but slow". You
don't get "safe, but moderately fast", which is what I think most
people care about.

					Thomas.
Newsgroups: comp.lang.c++
From: yaronl@mcil.comm.mot.com (Yaron Levy)
Subject: how to declare constants ?
Organization: Motorola Communications Israel Ltd., Tel Aviv
Date: Mon, 4 Jan 1993 09:38:40 GMT

Our project team is currently discussing the standards using constants. 
The meaning of constants is numeric values that are fixed in all modules, 
what used to be :
#define MAX_NAME_LENGTH  12

Currently we declare in our hpp files, outside the scope of the class
declaration : 
const UINT16 MAX_NAME_LENGTH = 12;

We are not satisfied with the current solution. For example, we prefer
that several constants will be inside the scope of classes.

Do you use a better, nicer convention ?

Please e-mail [yaronl@mcil.comm.mot.com], I'll post a summary. 

 - Yaron.
Newsgroups: comp.lang.c++
From: bsjaffe@icd.ab.com (Bruce S. Jaffe)
Subject: Dynamic Dispatch Virtual Tables
Organization: Allen-Bradley Company, Inc.
Date: Tue, 12 Jan 1993 18:37:13 GMT

A recent posting by Leo Lozner (leo@minsk.by) referenced the article
"The Dynamic Dispatch Virtual Tables", published in the May '92 issue
(vol 6 num 5) of ProgramNOW (Intra Press, London -- prognow@compulink
.co.uk).

I have not been able to locate a copy of this article, or to contact
either Leo or ProgramNOW.

Does anyone have a copy of this article which they could mail to me?

Alternatively, does anyone know how to reach ProgramNOW?

Please respond by email to bsjaffe@odin.icd.ab.com.

Thanks.
Newsgroups: comp.lang.c++
From: euamts@eua.ericsson.se (Mats Henricson)
Subject: Re: Why X: :X(X &a), not X::X(X a) ?
Reply-To: euamts@eua.ericsson.se
Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
Date: Tue, 12 Jan 1993 17:43:08 GMT

In article 22650@mobil.com, winney@dal.mobil.com (Randy Winney) writes:
#Could someone explain to us neophytes why C++ requires
#that I use the constructor
# X::X(X &a)
#instead of simply
# X::X(X a)

Because otherwise you'll end up with infinite recursion in this copy-
constructor. To be able to get into the main code of X::X you need a
copy of the argument, which will call the copy-constructor once again.
To be able to get into the main code of this call to the copy-constructor,
you need to make yet another copy of the argument, ... and so on...
until you kill your program, or the second law of thermodynamics gets you.

I also suggest you declare the argument as const, i.e.:
   X::X( const X& a );

Mats Henricson
Ellemtel Telecom Systems Labs
Stockholm
Sweden

Newsgroups: comp.lang.c++
From: pdl@rz.uni-jena.de (Lutz Donnerhacke)
Subject: Re: Reusability will come true bringing by OOP?
Reply-To: pdl@rz.uni-jena.de (Lutz Donnerhacke)
Organization: University Jena, Germany
Date: Tue, 12 Jan 1993 15:53:56 GMT


In article <1993Jan12.042140.27051@sparc4.ncu.edu.tw>, oper7@ee05.ncu.edu.tw (Anthony Shih Hao Lee) writes:
|> so I heard someone write an article (on a magazine) critized C++ is not
|> a good OOPL due to it is not well self-explained.

I think this is due to the programing style. If you program bottom-up, you will mostly
get unuseable code. If you program top-down, you will get better results, but a worst
performance, because you can test you program first if the last low level routine is coded.
example:
  void main(int argc, char **argv)
     {
        TGA-Stream tga(argv[1]);
        PCX-Stream pcx(argv[2],tga.xres(),tga.yres(),tga.colors());
        RGB-Color c;

        while( tga >> c )
          pcx << c;
     }

What's unreadable ?
Sure, now there is a lot of work to implement this classes, but all classes are readable !
?? OR ??

  Lutz (I prefer Smalltalk, because only bottom-up is allowed ;->)
+---------+----------------------------------------------------------------+
|snailMail| Lutz Donnerhacke; Alte Strasse 5; O-6902 Jena-Lobeda 1; Germany|
|eMail    | Lutz.Donnerhacke@Physik.Uni-Jena.DE   <pdl@hpux.rz.uni-jena.de>|
+---------+-------------------------------------------------------------L&C+
Newsgroups: comp.lang.c++
From: pault@dayfac.cdc.com (Paul Thompson;DAYFAC-ITS;)
Subject: static "inheritance" question
Summary: how to inherit static class members or do the equivalent
Organization: Control Data Corporation, Dayton, Ohio
Date: Mon, 4 Jan 93 14:43:20 GMT

Consider class A which counts its 'live' instantiations.
 
            class A {
                static int nr;
              public:
                A() {nr++;}
               ~A() {nr--;}
                int getNrInstances () {return nr;}
            };
            ...
            A::nr = 0;
 
A has useful functionality which I would like to use in other
classes with MINIMAL change to the other classes. One way
is to try:
 
    class B :public A { ....};
    class C :public A { ....};
     ...
    B b1, b2, b3;
    C c1, c2;
    cout << B::getNrInstances();
 
But this doesnUt work because static variables aren't inherited
(at least not in my compiler).
Could anyone enlighten me as to how to acquire the functionality
of a class like A that depends on a static variable with LEAST
modification to the acquiring class ? Thanks.
 
pault@dayfac.cdc.com
From: matt@physics2.berkeley.edu (Matt Austern)
Newsgroups: comp.lang.c++
Subject: Re: Passing 2-d arrys to functions
Date: 8 Jan 93 11:11:48
Organization: Lawrence Berkeley Laboratory (Theoretical Physics Group)
	<24568@alice.att.com> <726521188snx@trmphrst.demon.co.uk>
Reply-To: matt@physics.berkeley.edu
NNTP-Posting-Host: physics2.berkeley.edu
In-reply-to: nikki@trmphrst.demon.co.uk's message of 8 Jan 93 12:26:28 GMT

In article <726521188snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk (Nikki Locke) writes:

> The confusion between pointers and arrays in C (and C++) is one of the 
> tricky bits. Fervent C++ purists have even been know to say that array
> handling in C++ is completely broken (because it is like that in C), and
> should rarely be used. 

I happen to be of this opinion.  I believe that a well-designed array
class is essential, and should be part of the C++ Standard Library.
(Actually, make that several well-designed array classes; probably the
right solution is to have one class for one-dimensional arrays, and
another for multi-dimensional arrays.)  Now that templates are part of
the language, this is more practical than it used to be.

I've written my own array classes (I imagine that we all have), but it
would be nice if I could count on arrays being there in every
implementation.
--
Matthew Austern                   Just keep yelling until you attract a
(510) 644-2618                    crowd, then a constituency, a movement, a
austern@lbl.bitnet                faction, an army!  If you don't have any
matt@physics.berkeley.edu         solutions, become a part of the problem!
Newsgroups: comp.lang.c++,comp.object
From: roger@author.ecn.purdue.edu (Roger J Cass)
Subject: Re: Pros and cons of C++
Organization: Purdue University Engineering Computer Network
Date:  8 Jan 93 14:33:09 GMT

I am an engineer (well, actually still a grad student), so my approach to
using a language is maybe a little different.  I was involved in a finite-
element mesh generation package development group as part of my graduate work.
We chose C++ for a number of reasons. based on the technology as it stood
about 2 years ago.

First, like some of the other articles have stated, C++ offered the widest
platform of hardware.  At Sandia Nat'l Labs, where my research was sponsored,
the software had to be able to run on a number of high performance
workstations.  We were engineers turned programmers, not the other way.  We
knew exactly what the software had to do, because we were inventing the
solution as we went.  We had to pick some sort of standard that would allow
us to concentrate on getting better at mesh generation rather that worrying
about having to write the entire package.

In our search for modules that could take care of as much of our program as
possible, we discovered that OO technology was really the best *idea*, if
we could just find an existing solution.

We chose C++ because we needed a solid modeller that we could build on, that
would become a module in our program, not the program itself.  The ACIS
modeller by Spatial Technologies was the deciding factor.  We also needed
a GUI, and X seemed the best alternative since it was built in to all the
workstations.  Here again, the match between C++ and C was the clincher.

In the course of our program development, I ran into limitations in C++ very
quickly, but most were able to be worked around.  If our original concept
was purely OO, then our final product (which is available as part of DOE
technology transfer, contact me via email) is a network of patches to
make it a program.  The original OO framework has been lashed together
and short-circuited.  I am the first to admit that if I had been a better
C++ programmer, it wouldn't have been so bad, but overall I think we did
the best we could.

SUMMARY-- In my observations at 2 universities (BYU and Purdue) and at a
National Laboratory (Sandia) not very
many engineers have embraced the OO paradigm for modelling physical
systems and solving engineering analyses.  C++ is a good way to move into
OOP, but does not allow the OO paradigm to be realized in full-- which is
important to an engineer/programmer who does not care to become a guru just
to solve a problem.  Many engineers of still using **hack** FORTRA(SH)
(sorry, can't help it), and wouldn't care too much which OO language to
move into, except that it must be widely available.

I am still waiting for the successor to C++ as the OO programming language
of choice so I can get on with OO problem solving instead of programming.
--
Roger Cass               ! No success can compensate
roger@ecn.purdue.edu     ! For failure in the home
Purdue University CADLAB ! David O. Mackay
(317)494-5944            !
From: pauljo@microsoft.com (Paul Johns)
Subject: Re: How to limit string output length w/ stream manips?
Date: 11 Jan 93 23:15:13 GMT
Organization: Microsoft Corp., Redmond, Washington, USA

If you're mixing calls to C stdio.h functions
and C++ iostream function, you'll want to make
a call to ios::sync_with_stdio() so that the
output will come out in the right order.

// Paul
Newsgroups: comp.lang.c++
From: oper7@ee05.ncu.edu.tw (Anthony Shih Hao Lee)
Subject: TVISION:TVHelp is documented in manual?
Organization: Dep. of EECS, National Central University, Chungli, Taiwan, R.O.C.
Date: Sat, 9 Jan 1993 10:08:24 GMT

Hi, TV experters:
I explore the entire examples of TVISION and read the whole document of TV,
I cannot find any TVHelp information. I bought BC++3.0 & AF and upgrade
it upto 3.1, only a newer Programmer's Guide is included, does TV has upgrade?
then why I cannot find this feature in books but saw examples in files?
tony
-- 
>>> Anthony Li <Li3, Shih4 Hao2><Li:fruit's Name><Shih:Scholar><Hao:Hero>   <<<
<<< Institute of CSEE, National Central Univ, Chungli, Taoyuan, Taiwan, ROC >>>
>>> Internet:	oper7@mbox.ee.ncu.edu.tw	 oper2@ncuee.ncu.edu.tw	    >>>
From: ventura!vs@UCSD.EDU (Shankar Venkataraman)
Newsgroups: comp.lang.c++
Subject: Re: Need Help on Debugging Objects
Date: 8 Jan 93 01:21:07 GMT
Reply-To: ventura!vs@UCSD.EDU
Organization: Ventura Software, Inc., A XEROX Company

In article 256@ventura.UUCP, ventura!tim@UCSD.EDU (Tim Dierks) writes:
>I am looking for ideas on how to track the creation/deletion of objects for
>debugging purposes in an application I am writing.  For the PC, The Microsoft
>Foundation Class offers a TRACE macro that lets you display a message, but I'd like
>more functionality, and I don't plan on use the MFC.  I'd like to be able to do
>things like those listed below:
>
>- Display a message each time an object is created/deleted, identifying what type of
>  object it is, and some unique identifier for the object.
>- Identify the creator of each object when created.
>- Be able to dump the data members of any object currently in existence.
>- Be able to list all the objects currently in existence at any time.
>
>Has anyone had any experience with this?  Are there already existing class
>libraries or tools that do this sort of thing?  I'd appreciate any ideas.
>
One way to achieve this is by defining a class with a static member and declaring an
instance of the class in every class you want to debug. The constructor and destructor 
of the "trace" class give messages during creation and deletion.

class Trace {
private :
	static int ObjectCount;
	int id;
public :
	Trace : id(++ObjectCount)
	{
		cout <<  "Constructing Object # "<< id << "\n";
	}
	~Trace {
		cout << "Deleting Object # " << id << "\n";
	}
};

class MyClass {
private :

	int MyData;

#ifdef DEBUG_CLASS
	Trace MyTrace;
#endif

public :
	MyClass{};
	...
	...
};

This should help you to debug creation and deletion of objects.

Shankar V
ventura!vs@ucsd.edu


		
Newsgroups: comp.lang.c++
From: jar@solva.ifi.uio.no (Jo Are Rosland)
Subject: Re: using new
X-Md4-Signature: f92980b69468f75c25c2139d72153b3e
Organization: Dept. of Informatics, University of Oslo, Norway
Date: Sun, 10 Jan 1993 15:48:50 GMT
Originator: jar@solva.ifi.uio.no

In article <1993Jan8.171950.22884@news.columbia.edu> ae2@cunixa.cc.columbia.edu (Amiran Eliashvili) writes:
	   I am in the process of porting a C program into C++ and
   learning a lot about C++. I am trying to find an equivalent C++
   construct for the following malloc command:

	   ptr = (TypeCast *) malloc( LENGTH(n));

   where Length(n) is a macro that will return the n times of the
   desired object size. I have tried the following statement using new
   but for no avail:

	   ptr = (TypeCast *) new char(LENGTH(n));

This is really a question of the kind you'd find answered in any C++
tutorial book.  Your C++ should probably look like

    ptr = new TypeCast[n];

which means "allocate enough space for an array of n elements of type
TypeCast, then return a pointer to it of type TypeCast*".

The corresponding free() statement should look like

    delete [] ptr;

where the [] are necessary since you've allocated an array in the
first place.

--
Jo Are Rosland
jar@ifi.uio.no
From: durai@ortta.umn.edu (Durai Venkatasubramanian)
Newsgroups: comp.lang.c++
Subject: Re: A Fine Beginner's Book on C++
Date: 11 Jan 93 14:32:45 GMT
Organization: U of Mn

In article <1993Jan10.095448.9908@alchemy.chem.utoronto.ca> mbersohn@alchemy.chem.utoronto.ca (M. Bersohn) writes:
>From: mbersohn@alchemy.chem.utoronto.ca (M. Bersohn)
>Subject: A Fine Beginner's Book on C++
>Date: Sun, 10 Jan 1993 09:54:48 GMT
>As the best beginner's book on C++ for somebody who knows C I
>recommend TEACH YOURSELF C++ by Herbert Schildt, published by Osborne
>McGraw Hill  ISBN 0-07-881760-9 
>It is only a primer. There is no depth and it lacks detail; for
>example templates are not mentioned. BUT, there is a superb
>wealth of practice examples with answers and frequent quizzes
>with answers. The progression is quite gradual. This book is
>a highly efficient way to get started with C++, provided you
>know C. Incidentally this book is not mentioned in the FAQ.

Someone who does not know C, may not be able to appreciate the style and 
content of this book.

Even though I worked on C for a short while, I had completely forgotten C 
when I started on C++.  I found the book "c++ primer plus" by stephen and 
brata (publishers: waite group) better.
Newsgroups: comp.lang.c++
From: jabraham@acs.ucalgary.ca (John Abraham)
Subject: c++.newbie has problem with mult. #includes
Date: Tue, 12 Jan 93 17:21:29 GMT
Organization: The University of Calgary, Alberta

I have two classes, meplannode and emme2node.  Each of them is
derived from the base class node.

I want to use both of them in a file scope, so I #include "meplan.h" and
"emme2.h".  Problem - both of them #include "node.h", so I get
multiple definition errors for the node class.  What do I do?

It seems pretty kludgy to put:
#ifndef _classname
...
...
...
#define _classname
#endif
around every single .h file.

Is this a common problem?  Am I missing something obvious?


-- 
John E. Abraham                       ***** University of Calgary
jabraham@acs.ucalgary.ca               **** Department of Civil Engineering
Mathematical Modelling                  *** 2500 University Dr. N.W.
Computer Simulation                      ** Calgary, AB, T2N 1N4
Transportation and Land Use Interaction   * Canada


Newsgroups: comp.lang.c++
From: bruceb@roadrunner.denver.sgi.com (Bruce Bailey)
Subject: Re: How to prevent local instances, but allow "new"
Organization: Silicon Graphics, Inc.
Date: Tue, 5 Jan 1993 19:42:23 GMT

In article <1icij0INNdhc@news.cerf.net>, hlf@nic.cerf.net (Howard Ferguson)
writes:
|> I wish to define a class in a library which the library user
|> can create by dynamic allocation via the new operator, but
|> I want to prevent him from creating automic instances.
|> 
|> I thought that giving the class a public new operator,
|> but a private constructor would work, but this prevents
|> any instances of either type from being created.
|> 

Make the destructor private.

Bruce Bailey (bruceb@denver.sgi.com)
Newsgroups: comp.objects,comp.lang.c++,comp.lang.smalltalk,comp.lang.ada
From: buck@siswat.hou.tx.us (Lester Buck)
Subject: example application software from Booch
Organization: Photon Graphics
Date: Mon, 11 Jan 1993 06:38:42 GMT

In "Object-Oriented Design with Applications" by Booch, there is
a reference near the front that the source code for the applications
is available from the publisher.  But I can't find any reference
to where or how to order this software.

Does anyone have any pointers for ordering the Booch software for the
example applications?

Thanks alot,

-- 
A. Lester Buck   buck@siswat.hou.tx.us   ...!uhnix1!siswat!buck
From: tmb@arolla.idiap.ch (Thomas M. Breuel)
Newsgroups: comp.lang.c++
Subject: Re: Pros and cons of C++
Date: 8 Jan 93 23:24:39 GMT
	<79416@hydra.gatech.EDU>
Reply-To: tmb@idiap.ch
Followup-To: comp.lang.c++
Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
	Perceptive)
NNTP-Posting-Host: arolla.idiap.ch
In-reply-to: mhopper@emperor.gatech.edu's message of 7 Jan 93 20:15:36 GMT

In article <79416@hydra.gatech.EDU> mhopper@emperor.gatech.edu (Michael A. Hopper) writes:

   In article <TMB.93Jan7174627@arolla.idiap.ch> tmb@idiap.ch writes:

   [Hopper conveniently deleted the part where I talk about efficiency
   and what I like about C++]

   >What do I dislike about C++?
   >[several points deleted]

   It's important to remember that many trade-offs were chosen for C++
   for the sake of PERFORMANCE. This addresses points 2 [no pointer
   safety] and 5 [no garbage collection] above.

You also need to be aware that many of the design decisions behind C++
are driven by backwards compatibility, not by performance
considerations alone. C++ does not attempt to optimize performance
(even at the expense of safety), it attempts to optmize performance
while remaining C compatible.

In particular, if you design a language from scratch, supporting
pointer safety does not cost you very much. If you are designing a
language from scratch, supporting garbage collection will often give
you better performance than C++-style manual storage management (I
have posted several benchmarks supporting this claim to comp.lang.c++
in the past).

What makes those features costly in C++ is that they need to be
backwards compatible with C. Backwards compatibility is C++'s greatest
advantage over competing languages, but it is likely to be its
eventual downfall.  Safety and garbage collection and many of the
other features that I mentioned, are features that many programmers
want, and other languages will sooner or later catch on, languages
that offer them without the (significant, though not devastating)
overhead that would be associated with them you tried to support them
in C++.

					Thomas.
Newsgroups: comp.lang.c++
From: hansen@pegasus.att.com (Tony L. Hansen)
Subject: Re: Private vs. Protected
Organization: AT&T
Date: Wed, 13 Jan 1993 00:13:37 GMT
Summary: law of demeter
Keywords: private, protected, law of demeter

< From: vkessler@ncratl.AtlantaGA.NCR.COM (Vance Kessler)
<
< I would like to get your feelings as to when to use private versus when to
< use protected.
<
< I generally make instance variables protected to give direct access to
< sub-classes.  But, I am thinking that it might make maintenance easier to
< make them private and always access them through protected access
< functions.
<
< I would appreciate your opinions on this.

You should read up on The Law of Demeter as espoused by Dr. Karl Lieberherr.
It talks about the problems associated with cross-module data dependencies.
In particular, the law itself comes in two forms, called the weak and strong
formulations. The purpose of the law is to build systems that are easier to
understand and maintain. Among other things, the weak version says that
global variables are to be avoided and there should be no public member
data. The strong version goes further and says that there should be no
protected member data either.

					Tony Hansen
			    hansen@pegasus.att.com, tony@attmail.com
				att!pegasus!hansen, attmail!tony
Newsgroups: comp.lang.c++