HDTenEightyP/NetNews huggingface dataset:
From: sasghm@theseus.unx.sas.com (Gary Merrill)
Newsgroups: comp.lang.c++
Subject: Re: c++ & c+++
Date: 9 Nov 92 19:08:19 GMT
Article-I.D.: unx.BxGqHw.4IK
Organization: SAS Institute Inc.
Originator: sasghm@theseus.unx.sas.com


In article <24119@alice.att.com>, bs@alice.att.com (Bjarne Stroustrup) writes:
|> 
|> 
|> mccauleyba@vax1.bham.ac.uk (Brian McCauley @ University of Birmingham) writes
|> 
|>  > In article <1992Nov8.222637.5773@nmsu.edu>, willittl@spock.NMSU.Edu (William  Little) writes:
|>  > > The books I bought were for beginners, and didn't tell me 
|>  > > much.  I went through them in a couple hours, and came up
|>  > > with some questions in areas they didn't cover.

Given the state of C++ (particularly in certain areas such as templates
and exception handling) you will have some questions no matter *what*
collection of books you own.

|>  > Get the ARM (Annotated reference manual) I've never seen it but
|>  > everyone else sears by it! (I use "The C++ Prog.Lang.Edn.2" also by
|>  > the man himself which is probably not quite as good).
|> 
|> Depends what you need. The ARM and "The C++ Prog.Lang.Edn.2" cover the same
|> language (C++ including templates and exception handling) from two different
|> perspectives. They both contain the same reference manual.
|> 
|> The ARM is for language laywers and implementors and focusses on language
|> details and implementation techniques. Trying to learn C++ from the ARM is
|> a mistake; it would be like trying to learn English from a dictionary.

Agreed.  What you would miss by not having ARM is the "annotations"
(which are of technical interest, some historical interest, and at
times amusing).  No "normal person" trying to learn C++ now needs
ARM.

|> "The C++ Prog.Lang.Edn.2," on the other hand, tries to explain C++ programming
|> and design techniques. It is tutorial. Where it explains language features
|> it does so from the point of view of a user rather than an implementor.
|> I have been told that it is not only more comprehensive than the 1st edition
|> but also much easier to read.
|> 
|> I think the quality is about the same. Both have their place.

In addition to "The C++ Prog. Lang., Edn 2" you should also have
Stanley Lippman's "C++ Primer, 2nd Edition".  This will provide you
with yet more examples, and more complete treatments of some areas
(e.g., templates).  These two books provide a good basis for learning
the language as it now is (more or less).
-- 
Gary H. Merrill  [Principal Systems Developer, C Compiler Development]
SAS Institute Inc. / SAS Campus Dr. / Cary, NC  27513 / (919) 677-8000
sasghm@theseus.unx.sas.com ... !mcnc!sas!sasghm
Newsgroups: comp.lang.c++
From: olm@daimi.aau.dk (Ole Lehrmann Madsen)
Subject: Re: Nested Classes vs. Class Specialization
Organization: DAIMI: Computer Science Department, Aarhus University, Denmark
Date: Thu, 12 Nov 92 07:33:07 GMT

I have tried to send the following directly to Sieg, but the e-mail 
bounches back. Excuse me for posting it directly here.
---olm


In comp.lang.c++ you write:


>There seems to be a great benefit in using nested classes:  less
>chance of name space collision.

>For example, if we are creating a List class whose implementation consists
>of a class for a list head and a link or node class, there is merit to 
>embedding or nesting the node class inside the List class.

>However, suppose we use template classes.  Suppose we want to do template class
>specialization as discussed in Stan Lippman's "C++ Primer" 2nd edition. For a
>List class, we probably only want to  specialize the node class.

>When experimenting with nested template classes on Borland C++ v3.1, I could
>not figure out how to use nested template classes with specialization without
>respecifying the entire List class. This, of course, defeats the purpose of
>template class specialization.

>I therefore conclude that it is impossible to get the best of both worlds.
>For non-template classes, we want nested class but for template classes that
>might be specialized, we do not want nested classes.

>Can someone confirm this observation? Can someone figure out how to do 
>template class specialization of a Node class nested inside a List class
>without respecifying the entire List Class?

>			Thanks,
>					Sieg

Your observation about the problems in combining nested classes 
and inheritance seems very interesting. Since I am not an expert
in C++ details I am  not able to 'confirm your observation'.

In BETA we have for many years used nested classes in combination
with inheritance. This works quite well and is very useful.
Nested classes in BETA is, however, more general than in C++,
since a nested class in BETA can refer to variables in the enclosing
object. This is far as I know not possible  in C++.

Instead of templates we have 'virtual classes' (not the same as virtual
class in C++)

If you are interested in the BETA solution, I can refer you to

	1. O.L. Madsen: Block Structure in OOLs. In Shriver & Wegner,
	  Reserarch directions in OO, MIT Press 1987.

	2. O.L. Madsen, B. Moller-Pedersen: Virtual classes, a powerful
	   feature in OOP. OOPSLA 89

	3.O.L. Madsen, B. Magnusson, B. Moller-Pedersen: Strong typing
	  of OOLS revisited, OOPSLA 90

If you dont have access to these papers I can mail them. I can also
mail a preprint of a book on BETA to published by Addison Wesley next spring.

I am very interested in hearing what you find out about your 'observation'.
I think nested classes is a very poverful feature in combination with
inheritance. 

Sincerely

Ole Lehrmann Madsen
Computer Science Department
Aarhus University
Ny Munkegade
DK-8000 Aarhus C, DENMARK
Tel.: +45 86 12 71 88
Fax.: +45 86 13 57 25
E-mail: olmadsen@daimi.aau.dk
From: matt@centerline.com (Matt Landau)
Newsgroups: comp.lang.c++
Subject: Re: const char *
Date: 9 Nov 1992 15:23:41 GMT
Organization: CenterLine Software, Inc.
NNTP-Posting-Host: 140.239.1.32

In <BxD5uz.90q@slipknot.rain.com> robert@slipknot.rain.com (Robert Reed) writes:
>In article <92311.184452KSADEGH@auvm.american.edu> Kayvon Z. Sadeghi <KSADEGH@auvm.american.edu> writes:
>| mycall(const char *msg){
>|     if(msg=="")
>|          dothis();
>|     if(msg!="")
>|          dothat();
>|}
>|

>Your "" is not the same as your ""... Try something like:
>
>const char *Empty = "";
>
>mycall(const char *msg) {
>	if (msg == Empty)
>		dothis();
>	else
>		dothat();

The diagnosis is correct, but the solution is wrong.  This will have the 
exact same effect as the original poster's code unless the calling site 
declares "extern const char *Emtpy" and makes the call as 'mycall(Empty)' 
instead of 'mycall("")'.  I don't think this is really what the original 
poster had in mind.

Simply moving the string literal "" up and creating a global identifier
whose value is "" won't change the fact that two pointers to char are 
not "equal" simply because they point to different instances of the same
character sequence.

This is likely to be closer to Kayvon's intent:

	void mycall(const char *msg)
	{
	    if (msg == NULL || *msg == '\0')
		dothis();
	    else
		dothat();
	}

with the additional feature that 'mycall(NULL)' now behaves the same as 
'mycall("")'.  For those who value brevity, the if condition can be written
as 

	    if (!msg || !*msg)

without loss of generality.
From: collins@emperor.gatech.edu (Tom Collins)
Newsgroups: comp.lang.c++
Subject: Re: comp.lang.c++
Date: 12 Nov 92 16:28:59 GMT
Organization: CERL-EE, Georgia Institute of Technology

In article <1992Nov11.183520.15567@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>	comp.lang.c++ is certainly getting flooded.
>
>	It might be appropriate to have a comp.newuser.c++
>group or some other forum to soak up some of the postings 
>that really have nowhere else to go.
>
>	Any comments?

Yes, one fundamental comment.

We should partition the group functionally, not on the basis of
experience.  Choice of platform and operating system is a good
method (PC/DOS, etc.).   Application area is another possibility.
But a major aspect of these newsgroups is the ability to interact
with others who know more (or less).

-- 
Tom Collins                               tom.collins@ee.gatech.edu
Georgia Institute of Technology           (404) 894-2509
400 Tenth St. NW, CRB 384
Atlanta, GA  30332-0540 
Newsgroups: comp.lang.c++,bnr.lang.c++
From: dan@BofA.com (Dan Brockman)
Subject: Re: Criticisms wanted
Organization: Bank of America, Capital Products, RMTG #5906
Date: Fri, 13 Nov 92 04:53:23 GMT

In article <DECHC00.92Nov6072628@tohi.DMI.USherb.Ca> dechc00@tohi.DMI.USherb.Ca (CHRISTIAN DECHAMPLAIN) writes:
>
>I think that people that don't want to code in C++ are just afraid.  This is
>my opinion.  Just find a good compiler along with good programmers that don't
>fear learning a language that just helps them produce better code and you'll
>make a better product than with C.  The difficult part is to forget procedural
>desing and learn to design object-orientedly.
>

To deny people any other motive than fear for declining to pursue C++ is
simply character assasination.  It is possible for a person to consider
the various choices available to him or her and not choose the same one
you have chosen and by doing so make a rational and even a courageous 
choice.  

Also consider...  Do people choose not to code in COBOL because they
are afraid of it?



-- 
 --------------------------------------------------------------
 Daniel Brockman             tel 415-953-0406, fax 415-622-2892
 Bank of America, Dept 5906, 555 Calif St
 San Francisco 94104 USA    email uunet!odinba!dan dan@BofA.COM
Newsgroups: comp.lang.c++
From: mcgrant@rascals.stanford.edu (Michael C. Grant)
Subject: the COOL library
Organization: Information Systems Laboratory, Stanford University
Date: 10 Nov 92 17:18:11


I know that COOL is unsupported software, but I was wondering if there is
a standard group of people maintaining it.

I pulled both ice and lice (the lite COOL package) from an ftp site, and
it seemed complete and up to date. I fixed a couple of incompatabilities
with Sun CC 2.1 and lice's String and Gen_String classes, and otherwise it
all compiled without a hitch.

But then, as I examined the Complex.h class (which, in my opinion, should
have been a wrapper around the standard no-overhead-but-no-exceptions-either
AT&T complex class), I was startled to find:

inline Complex Complex::sin () const {
  return Complex (::sin (this->r), ::sin (this->i));
}

I was mortified! This is not even CLOSE to being correct... all of the
trigonometric and hyperbolic functions are definied in this manner,
so all are similarly incorrect.

So, if there is anyone out there who is collecting bug reports for COOL,
will you drop me a line? I'll gladly present you with modified versions of
the trig functions.

I must say I'm impressed overall, though... I especially like the template
pre-processor.

Michael C. Grant
mcgrant@isl.stanford.edu
From: tmb@arolla.idiap.ch (Thomas M. Breuel)
Newsgroups: comp.lang.c++
Subject: Re: operator [][]
Date: 12 Nov 92 11:56:39
Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
	Perceptive)
	<1992Nov9.114516.29846@alf.uib.no>
	<1992Nov11.182016.13511@ucc.su.OZ.AU>
Reply-To: tmb@idiap.ch
NNTP-Posting-Host: arolla.idiap.ch
In-reply-to: maxtal@extro.ucc.su.OZ.AU's message of Wed, 11 Nov 1992 18:20:16 GMT

In article <1992Nov11.182016.13511@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:

	   It would be nice if [] could work like (), that is one could
   declared

	   operator[](int,int,int){ ...}

   for example, that is, allow multiple arguments for [] just like ().
   This would allow multiple dimensioned matrices as well as providing
   a wealth of extra overloadable notations.

   It would of course break those programs for which

	   a[2,3];

   actually meant a[3] using the comma operator, but there surely are not
   so many of them ..??

Well, in principle that ambiguity is resolvable: you use the
"operator[](int,int)" interpretation only if such an operator is
actually defined. Of course, that would make parsing and compiling
even messier than it is now (think about templates...).

Altogether, we will probably just have to continue to live with what
is there.  I have been using "operator[]" less and less in my code
(only for 1D collections) and have been relying on "operator()" or
member functions ("foo.sub(x,y)") instead.

					Thomas.
Newsgroups: comp.lang.c++
From: 870086t@dragon.acadiau.ca (Shannon Tremblay)
Subject: object classes
Keywords: Object, DoubleList
Organization: Acadia University
Date: Mon, 9 Nov 1992 17:26:51 GMT



hi all,

I am trying to build a graphics editor.  Just the basic shapes, each one 
to be treated as an object.
Sounds like a simple task, right?  I thought so.
Here is a sample of my class definitions.  I  have left out some parameters
in some of the functions for simplicity.


//
//Sample Code 
//

class Shape : public Object
{
public:
	Shape();
	~Shape();
	
	virtual char* nameOf();			// pure virtual members 
	virtual classType isA();		// from class Object
	virtual void printOn( ostream& );
	virtual hashType hashValue();

	virtual void Draw();
	virtual void Assign();
private:
	int	figure,
		color,
		style;
};

class Square : public Shape
{
public:
	Square();
	~Square();
	void Draw();
	void Assign();
private:
	int x1, x2, y1, y2;
};

class Circle : public Shape
{
public:
	Circle();
	~Circle();
	void Draw();
	void Assign();
private:
	int x1, x2, y1, y2;
};


class ObjectList : public DoubleList
{
public:
	ObjectList();
	~ObjectList();
	add(Object&);
	detach(Object&, DeleteType);
	void Display();
private:
	BOOL  dirty;	// just marks when an object is touched in some way.
};



I believe I have the objects adding onto the list properly, but I can not 
iterate through the list of object inorder to refresh the screen when needed.
Also when I  return something it is of type Object and therefore I loose 
the member functions I created under Shape.

Does anyone know of source code that would demonstrate to me how to go about
creating an object, placing it in a list, and then being able to retrieve
the object, intact, as it was placed on the list, that is derived members 
still avialable.  As well as being able to iterate through the list,
accessing the derived functions as I go.  

Or am I expecting too much???  I didn't think so...

thanks in advance

shannon.tremblay@acadiau.ca
From: holiday@bnr.ca (Matthew Holiday)
Newsgroups: comp.lang.c++
Subject: Re: Discriminating Variant Records Without switch() ??
Date: 11 Nov 92 14:42:53 GMT
Reply-To: holiday@bnr.ca
Organization: Bell-Northern Research, Richardson, TX

In article <BAB.92Nov10073324@se39.wg2.waii.com>, bab@se39.wg2.waii.com (Brian Button) writes:
|> Is there a simple, OOP based way to discriminate between variant
|> records? I saw an article in C Users Journal last month titled "Switch
|> Deemed Harmful to C++" or something like that, but I couldn't figure
|> out how to do it any other way.
|> 
|> As an example:
|> 
|> We're reading structures sent to us over a socket. Since these
|> structures are being sent and received on the same machine, we can
|> just memcpy the byte stream read from the socket into a big union, and
|> then switch based on the first field of the union to determine the type.
|> 
|> [text ommitted]
|> 
|> This works, but doesn't look very OOP-ish. Can anyone give me any
|> suggestions about how this can be reformed to fit in with the object
|> paradigm and not use the switch statement?

Another (not quite OOP-ish) way is to have an array of function pointers,
and index the array with the first field of the union.  Note that you need
an appropriate nil function for all the array entries which represent invalid
indices.  This is pretty straightforward.

The OOP-ish way would be to construct an object of the appropriate class to
match your input message, and then call that object's methods (which would
be overridden as necessary for specific subclasses).  Unfortunately, the
part of your code where you construct the object is likely to be non-OOP-ish,
in fact, it'll probably require a switch statement! :-)  There ought to be a
convenient way to create objects from network messages, i.e., some way to
register message types and their matching class types, such that for every
incoming message, its body (an array of bytes) gets turned into the correct
object, which would be derived from a root generic message object.

-- 
Matt Holiday                                      #include <std/disclaimer>
holiday@bnr.ca
BNR Richardson, TX
Newsgroups: comp.lang.c++
From: sakkinen@jyu.fi (Markku Sakkinen)
Subject: Re: Wanted: Example of Contravariance
Organization: University of Jyvaskyla, Finland
Date: Tue, 10 Nov 1992 10:06:14 GMT

In article <rmartin.721098936@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
> ...
>Notice that the arguments of the two 'f' functions are the same.  This
>is "contravariance", since the argument does not (contra) vary with
>the class type.  

You are mistaken about the terminology.
Contravariance means that the class of an argument for a function
redefined in a derived class may be a base class of the same
argument's class in the original function.
('Contra' means that the subtype relationship between the arguments
is opposite to that between the classes in which the functions are defined.)
C++, as defined by the ARM has _neither_ contra- nor covariance.

>However, the return values are "covariant" since they do (co) vary
>with the class type.
>
>Although covariant return types have been accepted into the language
>definition, I don't think they are accepted by many of the compiler
>out ther right now.  Contravariant arguments are mandatory in C++.

Which language definition?

----------------------------------------------------------------------
Markku Sakkinen (sakkinen@jytko.jyu.fi)
       SAKKINEN@FINJYU.bitnet (alternative network address)
Department of Computer Science and Information Systems
University of Jyvaskyla (a's with umlauts)
PL 35
SF-40351 Jyvaskyla (umlauts again)
Finland
----------------------------------------------------------------------
From: ameesh@lsil.com (Ameesh Desai)
Newsgroups: comp.lang.c++
Subject: Re: Wanted: Example of Contravariance
Date: 10 Nov 92 19:53:55 GMT
Reply-To: ameesh@lsil.com
Organization: LSI Logic Corporation

In article 721098936@thor, rmartin@thor.Rational.COM (Bob Martin) writes:
>srheintze@happy.colorado.edu writes:
>
>>Can someone please give me a small example of contravariance I can compile and 
>>run with Borland C++ v3.1 or Microsoft C++ v7?
>

[suff deleted]

>class B
>{
>  public:
>    virtual B& void f(B&);
		^^^^^^^^^^^^^^ ???? what is "virtual B& void f(B&)" ?
		Am I missing something here or is this a syntax error ? 
>};

[stuff deleted]

>
>--
>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++



---
______________________________     o__            
| _   /|     Ameesh Desai     \    ,>/_                              
| \`O.o'     LSI Logic Corp.   \__(_)`(_)_              email: ameesh@lsil.com
| =(_|_)=    MS E192, 1501 McCarthy Blvd. \             fax  : (408) 433-6802
|____U_______Milpitas, CA 95035____________\____________voice: (408) 433-4097
From: RKOHLBUS@jennifer.umd.edu (Robert C. Kohlbus)
Newsgroups: comp.lang.c++
Subject: TSRs
Date: 12 Nov 92 20:35:17 GMT
Organization: University of Maryland


	I'm looking for anyone who can sent me information or code on how to 
remove a TSR program from memory.  I would like to have a user be able to 
use the command like option like <program ON|OFF> so that they can unload 
and load the TSR as it is needed.  Anyone out there that can give me a hand 
I would really appreciate it.

=========================================================================

Robert Kohlbus
University of Maryland
Network Admin. / Computer Programmer
Internet:
    rkohlbus@jennifer.umd.edu
    kohlbus@wam.umd.edu

=========================================================================
From: yli@acsu.buffalo.edu (Yanhong Li)
Newsgroups: comp.lang.c++
Subject: Re: Bus error
Date: 11 Nov 92 22:26:39 GMT
Article-I.D.: acsu.BxKp0G.Hy6
Organization: State University of New York at Buffalo/Comp Sci

In article <1992Nov11.183909.24097@cc.umontreal.ca> nadeau@JSP.UMontreal.CA (Nadeau Jean-Claude) writes:
>In article <BxJ1nK.B0y@acsu.buffalo.edu> yli@acsu.buffalo.edu (Yanhong Li) writes:
>>#include <iostream.h>
>>
>>class T {
>> public:
>> int i;
>> void foo() {cout <<"foooo\n";}
>>};
>>
>>void main(){
>>T *tt[3][5];
>>
>>tt[2][3]->i=1;
>>}
>	Well, another C (NOT C++) pitfall.  You've declare "tt" as an array
>	of array of POINTER to T.  So there is memory for 15 pointers not
>	for 15 objects of type T.  You'll have to reserve memory for those
>	objects and INITIALIZE the pointers to the addresses of those blocks
>	of memory.  Or declare "tt" like that (If it's possible):
>
>		T tt[3][5];

Well, in some circumstances, I can not declare tt as an array of T, because
T has virtual member functions, and I may assign tt to a derived class of
T. That's why I must use pointer.


>
>	It's better to learn C before trying to use C++ ;-)
>
>	A not so joking idea. ;-)
>-- 
>Jean-Claude Nadeau, ing.	<nadeau@ERE.UMontreal.CA>
>Services informatiques		Tel. (514) 343-6111,ext 5234
>Universite de Montreal		Fax  (514) 343-2155


-- 
===============================================================================
Yanhong Li                          716-838-6493(h)    645-3198(o)
Dept. of Computer Science                       Good good study                
SUNY at Buffalo, Buffalo, NY14260               Up up every day
From: heddaya@csa.bu.edu (Abdelsalam Heddaya)
Newsgroups: comp.lang.c++
Subject: C++ pretty printer?
Date: 12 Nov 92 03:20:36 GMT
Distribution: comp
Organization: Boston University, Computer Science Dept.


Does there exist a C++ pretty printer?  I mean a program that will
neatly typeset C++ programs.

This may be a Frequently Asked Question; apologies in advance if this
is so.
Newsgroups: comp.lang.c++
From: kelsey@redwing.SLAC.Stanford.EDU (Mike Kelsey)
Subject: Re: Bad 'for' statement?
Keywords: AT&T for
Organization: Stanford Linear Accelerator Center
Date: Thu, 12 Nov 1992 16:27:59 GMT

In article <1992Nov12.160420.18097@rs6000.bham.ac.uk>, pickerig@eee.bham.ac.uk (Mr. G. Pickering) writes:
|> Hi,
|> 
|> Could you tell me if this is really a syntax error as AT&T 2.1 reports?
|> 
|>   for(int i=0, int j=10;   i<10;   i++, j++)
|>   {
|>     // do something
|>   }

Yes it is.  GCC 2.3.1 also calls it an error, claiming that the function 'j' is
undeclared. You can fix it by eliminating the second 'int', since the comma in
that construction does it for you.  Here is a complete sample program:

#include <stdio.h>
int main()
{
  for (int i=0, j=10; i<10; i++, j++)
    printf("\n i=%d, j=%d",i,j);
}

|> 
|> Thanks,
|> 
|> Guy

You're welcome. :-)
						-- Mike Kelsey
-- 
[  My opinions are not endorsed by SLAC, Caltech, or the US government  ]
"I've seen things you people wouldn't believe.  Attack ships on fire off
the shoulder  of Orion.   I've watched  C-beams glitter in  the darkness
near the Tannhauser Gate.  All these memories will be lost in time, like
tears in the rain."  -- Roy Batty
From: brownlow@informix.com (Keith Brownlow)
Newsgroups: comp.lang.c++
Subject: good c++ training videos
Keywords: training video
Date: 10 Nov 92 21:32:52 GMT
Organization: Informix Software, Inc.

I'm looking for some training videos on c++, ideally designed for a competent
C programmer switching to c++. If anyone has had any good experiences with
a c++ video, could you please let me know the details of the video.  Or if
you have had any BAD experiences please let me know also.  Either is MUCH 
appreciated.

Keith Brownlow.