HDTenEightyP/NetNews huggingface dataset:
From: njs@planet.bt.co.uk (Non NIS Account)
Newsgroups: comp.lang.c++
Subject: Re: Friend ..Overload Assignment opertr ..
Date: 26 Jan 93 15:11:54 GMT
Organization: DNM42, BT Labs, Martlesham Heath, Ipswich, UK.
Originator: njs@andromeda


In article <1993Jan22.075317.21062@usl.edu>, rks9954@usl.edu (Srinivasa Rao K) writes:
|> 
|>  
|> 
|> 
|>  Hi C++ masters,
|> 
|>        I have small question ...
|> 
|>        I am writing a "string"  class which i should be able
|>        to use like
|> 
|> 
|>        string str1;
|> 
|>        str1 = "Hello world" ;
|> 
|> 
|> 
|>        But We canot use a friend to overload the assignment oprator.

Why should you want to use a friend to redefine the assignment operator?  If you are designing a class you can also include a definition for the `=` operator to give it the semantics you want.  See 13.4 ARM.

|> 
|>       So finally  I had to convince myself to use something like
|> 
|> 
|>        str1 <= "Hello world"
|> 
|> 
|>        which works.
|> 
|>       Is there any way to do the first method ....
|> 
|>       
|>       Thanks for those who spend time reading this ....
|> 
|> 
|> 
|> 
|> Rao.
Newsgroups: comp.lang.c++
From: energy@nynexst.com (energize-test)
Subject: What's your view on Lucid's Energize
Reply-To: energy@nynexst.com
Organization: NYNEX Science & Technology, Inc
Date: Wed, 27 Jan 93 14:54:14 GMT

I am currently working on the evaluation of the Lucid developement environment called
Energize. To make things more spicy our application uses ObjectStore as well.

In any event i have been using the environment for a month or so but before I pass
final judgement on the thing I wanted to see if any one in netland had insights
they wanted to share. 
Thankyou and I am eagerly awaiting your input.

afshin
afshin@nynexst.com
From: afeinsil@ucs.indiana.edu (AMIR FEINSILBER)
Newsgroups: comp.lang.c++
Subject: Re: How does one use 68000 subroutines with C++ ???
Date: 21 Jan 93 05:54:14 GMT
Organization: Indiana University

In article <C1640F.54y@cs.uiuc.edu> ctaylor@cs.uiuc.edu (Conrad Taylor) writes:
>From: ctaylor@cs.uiuc.edu (Conrad Taylor)
>Subject: How does one use 68000 subroutines with C++ ???
>Date: Wed, 20 Jan 1993 19:41:03 GMT
>         I was wondering , is there anyway to use assembly language
>routines with C++?  I'm using SunOS operating system with AT&T 2.1
>CC compiler (cfront).  Thanks in advance to all that reply to this     
>post.
>
>-Con(rad)
>
>ps: Please e-mail me at ctaylor@silver.lcs.mit.edu or
>    taylor1@wse.eecs.uic.edu.
>
>
From: atkins@nosc.mil (Hugh T. Atkins)
Newsgroups: comp.lang.c++
Subject: help with pass-by-reference
Keywords: c++,reference,pass
Date: 22 Jan 93 23:18:48 GMT
Distribution: usa
Organization: Naval Ocean Systems Center, San Diego, CA

Here's the setup, I have a class called Card and declare an array as
follows


Card myHand[5];  // this is an array of 5 playing cards

I want to write a function which tests for pairs of cards and I want
to use pass-by-reference but I can't figure out how to declare the
function prototype.

I'd like the function to return an int, something like this

int hasPair( const Card& );

then later I would use

if( hasPair( ?????? ) )
  pairs++;

Can anyone help ? I realize this is sketchy and will provide more info
if needed.

Thanks , Hugh
From: eggert@rbg.informatik.th-darmstadt.de (Lars Eggert)
Newsgroups: comp.lang.c++
Subject: ET++ on HP9000
Date: 21 Jan 1993 15:18:07 GMT
Organization: TU Darmstadt
Distribution: world
NNTP-Posting-Host: rbhp43.rbg.informatik.th-darmstadt.de
Keywords: ET++ HP9000

Has anybody installed ET++ on a HP9000 successfully?
We are trying to install 3.0 alpha, but get nothing
but crashes.

HOW CAN IT BE DONE?

Lars Eggert (eggert@rbg.informatik.th-darmstadt.de)
"Good food, good meat, good god - let's eat!"
(Prayer by Homer Simpson)










Newsgroups: comp.lang.c++
From: jss@lucid.com (Jerry Schwarz)
Subject: Re: buffering iostreams
Reply-To: jss@lucid.com (Jerry Schwarz)
Organization: Lucid, Inc.
Date: Thu, 28 Jan 93 03:40:02 GMT

In article <1k2co6INN7mm@wilma.cs.widener.edu>, quairoli@cs.widener.edu (Patrick J. Quairoli) writes:
|> i'm trying to take a long (i.e. 72) and cast it as a char so
|> that i get a value of 'H'.  this can be easily done by:
|> 
|> long foo = 72;
|> 
|> cout << (char)foo;
|> 
|> BUT!  i also want the output to be buffered as an long (4 bytes).
|> 

First, what you're talking about is generally called "padding"
not "buffering", and long's aren't normally padded to 4 characters
either.  

|> 
|> cout << setw(sizeof(long)) << (char)foo;
|> 
|> which gives me 'H' but it is not buffered (i.e. its' flush with the
|> left of the screen and there are no trialing spaces). if it were
|> buffered as a long it would be 'H   '.
|> 

Much of the documentation of iostreams says that the char inserter
pads. But the original AT&T library didn't and most (maybe all)
of the other implementations have followed the original implementation
(rather than the original documentation). 

The standards committee will probably go along with the existing
implementations rather than the original documentation and say
that the char inserter doesn't pad either.

|> if i use:
|> 
|> cout << setw(sizeof(long)) << foo;
|> 
|> i get 72 and it is buffered with 2 leading spaces (i.e. two bytes)....
|> 
|> ? how do i get a long to be cast as a char and still buffer it?
|> 

One way is to use a string rather than a char.

	char a[2] ;
	a[0] = foo ;
	a[1] = 0 ;
	cout << setw(sizeof(long)) << a 

If you you're going to be doing this much, you might find it convenient
to wrap it up in a manipulator.

	#include <iostream.h>
	#include <iomanip.h>

	ostream& paddedcharf(ostream& o, int c) {
    	char a[2] ;
    	a[0] = c ;
    	a[1] = 0 ;
    	return o << setw(sizeof(long)) << a ;
	}

	OAPP(int) paddedchar(paddedcharf) ;  

	...
	cout << paddedchar(foo) ;

I used an "int" manipulator rather than a "long" (as might
be suggested by the original problem) because iomanip.h declares
it. 

And finally with regard to whether padding comes before
or after the value.  This can be controlled by flags.  To get
the padding after the data instead of before (the default is
before) you do

	cout.setf(ios::left,ios::adjustfield) ;

The flag specifies where the data goes.

   -- Jerry Schwarz
From: bytor@grumpy.NoSubdomain.NoDomain (Ross Huitt)
Newsgroups: comp.lang.c++
Subject: Re: C++ maintenance
Date: 24 Jan 93 17:35:22 GMT
Distribution: na
Organization: Bellcore

The January '93 issue of IEEE Software is a special OO issue. One of the articles
discusses at length some of the issues involved in maintaining OO software. This
topic, in particular, is discussed. Check it out.

    -bytor

Ross Huitt
bytor@ctt.bellcore.com

In article <C1BnAy.C3F@geovision.gvc.com>, djb@geovision.gvc.com (Darren Burns) writes:
|> 
|> I recently had the pleasure (not) of trying to track down a bug in
|> some C++ code.  The author(s) of the code were not that experienced
|> in C++, but I don't think that matters here.
|> 
|> I just wanted to get some comments about the following.  Suppose I'm
|> looking at a C++ program.  I have a pretty good understanding of what
|> it does, but I'm not terribly familiar with the code.  In a member
|> function I see:
|> 
|> int the_class::do_something ( )
|> {
|> ...
|>     foo->xxx();
|> ...
|> }
|> 
|> Now, I'm browsing through this code and I'm thinking maybe the bug I'm
|> looking for is in xxx().  I want to take a look at it.  In order to know
|> which xxx to look at (since there may be many classes that have xxx), I
|> need to know what class foo is.  But foo could be a global variable,
|> a member of the_class, or a variable local to the function.  I have to
|> hunt all over the place just to find out where to look for xxx.
|> 
|> I find this a real pain.  I'm not experienced with C++, so maybe it's
|> something you get used to.  I think that it's a general problem with
|> OOP, although the syntax of the language can make it better or worse.
|> It seems that C++ is great if you know the program very well (i.e. if
|> you designed/wrote it), but is difficult to maintain.
|> 
|> Are there others who find the same thing?  Is there some way of setting
|> things up to avoid this sort of problem?
|> 
|> Thanks.
|> 
|> (I never did find that bug, by the way :-))
|> 
|> Darren Burns
From: pickerig@eee.bham.ac.uk (Guy Pickering)
Newsgroups: comp.lang.c++
Subject: Template Use <sigh>
Date: 21 Jan 1993 17:10:11 GMT
Organization: The University of Birmingham, England
NNTP-Posting-Host: annapurna.eee.bham.ac.uk
X-Newsreader: TIN [version 1.1 PL6]

I imagine this an FAQ, so please excuse my ignorance (anyone know where
to get an FAQ list?).

I am starting to use templates (AT&T V3.01), I define the templates in
a separate directory to my main source code. I keep getting the following
warnings and errors:

  CC[ptlink] warning: template definition file LookupTable.C not found
  .
  .
  .
  CC[ptlink]: unresolveable template symbols are:
        LookupTable<unsigned char>::~LookupTable<unsigned char>(void)
  CC[ptlink] fatal error: template symbols cannot be resolved

I do not have a full understanding of how template code is created. I
assume it is not the same as the usual compile-link phases for C/C++ code.

Could someone enlighten me as to a) What my problem is, as described
above, and b) How the template thing works?

Many thanks in advance,

Guy.

--
+--------------------------------+-----------------------------------------+
| Guy Pickering                  | School of Electronic & Electrical Eng,  |
| E-MAIL: G.PICKERING@uk.ac.bham | University of Birmingham,               |
| Tel: (021) 414 4340            | Edgbaston, Birmingham. B15 2TT.         |
+--------------------------------+-----------------------------------------+


Newsgroups: comp.lang.c++
From: jss@lucid.com (Jerry Schwarz)
Subject: Re: setjmp/longjmp question
Reply-To: jss@lucid.com (Jerry Schwarz)
Organization: Lucid, Inc.
Date: Wed, 27 Jan 93 04:59:37 GMT

In article <KANZE.93Jan25184636@slsvdnt.us-es.sel.de>, kanze@us-es.sel.de (James Kanze) writes:

|> 
|> The C++ standards committee have said that they are adopting the C
|> library more or less integrally, so I would suppose that this means
|> setjmp/longjmp too.

The committee decided to include setjmp/longjmp, but with the
proviso 
 
    "If any automatic objects would have been destroyed as a 
    result of an exception passing control to the same function
    as the longjmp, the results of the longjmp are undefined."

In effect, this means that longjmp is present and will work the
way it does in C provided all your code stays in the C subset.
In code using constructors and destructors (what some people
might call "real C++") you shouldn't use it.  Note it isn't
just that the destructors may or may not be called, but the
exception handling mechanism itself might be corrupted by
use of longjmp.

I believe there were three points of view expressed during
the discussions leading up to this decision.

A) Not include them in the standard library. Vendors would be 
   free to continue to support them in any way they chose.

   The objection to this was that it might severely
   impact people trying to turn C code into C++. 

B) Include them and "fix them" to call the destructors (the
   way exceptions would). 

   The objection to this is that a lot of C++ code already 
   exists that uses longjmp/setjmp and doesn't expect the
   destructors to be called.  This alternative might 
   severely impact such code. And it would 
   make it  difficult to write code that works both
   with today's systems and future systems that implement
   this rule.

C) Include them and say they don't call destructors. 
   
   The objection to this is that the standard shouldn't contain
   a mechanism for subverting the usual guarantee that destructors
   are called when stack variables are deallocated.

I believe this will work out reasonably well.  People can continue
to use setjmp/longjmp.  As vendors phase in exception handling 
they ought to continue to support existing use of setjmp/longjmp
As systems without exceptions fade away programmers should discontinue
using setjmp/lonjmp.  (Although I personally think the transition
period will be measured in decades.) 

   -- Jerry Schwarz
Xref: sparky comp.lang.c++:20106 comp.std.c++:2149
From: mat@mole-end.matawan.nj.us
Subject: Re: Why is C++ not considered a true OOL?
Summary: Greatest Achievement
Organization: :
Date: Mon, 25 Jan 1993 01:31:22 GMT

In article <1993Jan21.005415.2812@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
 
> 	But your greatest achievement, Bjarne, in my opinion,
> was the name dominance rule, because, coupled with virtual
> bases and abstract classes that enables mixins.

Bjarne's greatest achievement, IMO, was getting A-W to publish the
first book, thereby making C++ a `serious' language in the eyes of the
masses _and_ their managers.

(Bjarne, I don't mean to slight any of the other great stuff you've
done ...)
-- 
 (This man's opinions are his own.)
 From mole-end				Mark Terribile

 mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
Newsgroups: comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: References to functions?
Organization: TauMetric Corporation
Date: Thu, 21 Jan 1993 17:33:52 GMT

fritz@mtl.mit.edu (Frederick Herrmann) writes:

>I tried to declare a reference to a function, but found that g++
>wouldn't let me.  After scanning ch. 8 of the ARM, I interpret it to
>forbid function references, but it's not all that clear (see below).

References to functions are legal, but not very useful.  I can't
think of anything you can do with a reference to a function you
can't do with a const pointer to a function in exactly the same way,
except for trivial syntax differences at the point of initialization.
You use them in exactly the same way.

int foo(int);

typedef int (&fooref)(int); // reference to function
typedef int (*fooptr)(int); // pointer   to function

fooref       fr = *foo;
fooptr const fp = foo;

int j = fr(3);	// call function via reference
int i = fp(2);	// call function via pointer

int bar(int);
fr = *bar;	// error, can't assign to a reference
fp = bar;	// error, can't assign to a const pointer

class Xr {
    fooref frm;
    Xr(fooref f) : frm(f) { }
    Xr() { } // error, reference member not initialized
};

class Xp {
    fooptr const fpm;
    Xp(fooptr f) : fpm(f) { }
    Xp() { } // error, const member not initialized
};
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Newsgroups: comp.lang.c++
From: twallace@gmuvax2.gmu.edu (Todd Wallace)
Subject: Re: matrix class
Keywords: matrix
Organization: George Mason University, Fairfax, Va.
Date: Wed, 27 Jan 1993 03:35:05 GMT

I am looking for a nice matrix class for c++ with overloaded
operators (*m, for example). Anyone have source code or know
where I can get some?
Thanks.
----------------------------------------------------------------
|    Todd Wallace               |  "A pessimist is surprised   |
|    twallace@gmuvax2.gmu.edu   |   as often as an optimist,   |
|                               |   but always pleasantly."    |
|                               |            - Robert Heinlein |
----------------------------------------------------------------
Newsgroups: comp.lang.c++
From: indukuri@eagle.sangamon.edu (Padmaja Indukuri)
Subject: need source code to create windows in TURBO C++
X-Newsreader: TIN [version 1.1 PL6]
Organization: Sangamon State University
Date: Sun, 24 Jan 1993 23:40:16 GMT

		Hi netters,
				I am in need of source code for creating windows
				in Turbo C++. I got source code for creating
				windows in ZORTCECH C++. But it is missing
				a header file <disp.h>. Can I get that header 
				file by asking the publishers?

				Can anybody send me information about creating 
				windows in TURBO C++ ? Please send me email to 
				indukuri@eagle.sangamon.edu

				Thanks in advance

				Padmaja
From: dernis@binah.cc.brandeis.edu
Newsgroups: comp.lang.c++
Subject: Re: TVision: prevent closing windows?
Date: 26 Jan 93 18:33:23 GMT
Reply-To: dernis@binah.cc.brandeis.edu
Organization: Brandeis University

In article <1993Jan26.132907.26715@scott.skidmore.edu>, pvonk@scott.skidmore.edu (Pierre VonKaenel) writes:
>
>I would like to have a window on the screen that never closes (the
>class is never destroyed until the end of the program), but may be
>toggled between hidden and displayed.  I found how to prevent having a
>close icon (upper left corner), but how can I prevent it being closed
>using the "Window | Close" command from the menu bar (I want to allow
>other windows to close).  Is there a simple flag to do this, or do I
>have to write a handleEvent() and intercept cmClose events?
>
>Thanks....  
>
>
>-- 
>Pierre von Kaenel  |  Math & CS Dept | Skidmore College | pvonk@skidmore.edu
>----------------------------------------------------------------------------
>Ads from premier issue of PC Tech Journal (Jul 83): 20MB Hard disk from
>QCS - Cost: $2999.   Davong 5 MB int. hard disk... only $1465!

Yes, disable the command cmClose, when the window is selected, and
enable it with others. 

If you need more details, I can fill them in later.

Mitch Dernis
From: pickerig@eee.bham.ac.uk (Guy Pickering)
Newsgroups: comp.lang.c++
Subject: Re: Template Use <sigh>
Date: 28 Jan 1993 09:49:42 GMT
Organization: The University of Birmingham, England
NNTP-Posting-Host: nanda_devi.eee.bham.ac.uk
X-Newsreader: TIN [version 1.1 PL6]

Thank you to all that helped, especially Steve Vinoski at Hewlett-Packard.
I have now sussed it and am instantaiting in the library where the
template code is.

I have also seen in another thread that libraries cause CC problems
for determining instantiation needs, but as I understand it there
is a bug fix for V3.0.1 to solve this.

Thanks again,

Guy.

--
+--------------------------------+-----------------------------------------+
| Guy Pickering                  | School of Electronic & Electrical Eng,  |
| E-MAIL: G.PICKERING@uk.ac.bham | University of Birmingham,               |
| Tel: (021) 414 4340            | Edgbaston, Birmingham. B15 2TT.         |
+--------------------------------+-----------------------------------------+


Newsgroups: comp.lang.c++
From: erc@netcom.com (Eric Smith)
Subject: Re: Compiling a string class
Organization: Netcom - Online Communication Services (408 241-9760 guest)
Date: Wed, 27 Jan 1993 08:36:11 GMT

In article <765370d7928835t20@roofus.ann-arbor.mi.us> "Tim Triemstra" <empath@ais.org> writes:
>ztc -mx -c str.cpp strsearch.cpp regx.cpp match.cpp dynstream.cpp
>ztcpp1x -DDOS386 -3 -ms -oC:\UTILS\TEMP\ztc_1.tmp str.cpp
>   str(const char *, const str::substr& );
>                                      ^
>str.h(123) : Error: ')' expected

What Zortech version is it?
Newsgroups: comp.lang.c++,gnu.g++.help
From: fritz@mtl.mit.edu (Frederick Herrmann)
Subject: References to functions?
Followup-To: comp.lang.c++
Organization: MIT Microsystems Technology Laboratories
Date: Thu, 21 Jan 1993 04:40:13 GMT

I tried to declare a reference to a function, but found that g++
wouldn't let me.  After scanning ch. 8 of the ARM, I interpret it to
forbid function references, but it's not all that clear (see below).

Here's what I was trying to do:

	typedef void (&rfi)(int);
	typedef void (*pfi)(int);

	class X {
	public:
	  rfi f;

	  X( pfi ff) : f( *ff) {};

	  void some_member_func( int i) { f(i); }
	};

Looks reasonable to me, except I can hear the grumbling that f is not
properly initialized, since ff could be a dangling pointer.  On the
other hand, g++ lets me get away with this:

	class Y {
	public:
	  int& ri;

	  Y( int* pi) : ri( *pi) {};
	};

which has the same problem when I construct Y(0).

Now ARM 8.4.3 says a reference must be initialized by an "object", and
if a function is not an object then class X is out.  But the last
paragraph of 8.2.2 gives a long list of things that can't be
referenced, and functions are not listed.

It's not a big deal to me, since it's really a matter of notational
convenience.  I'd be grateful for some discussion; can someone tell me:

* A place in the ARM or other source where this is more clearly
  forbidden.

* An explanation of implementation issues or other reasons why
  function references are a bad idea.

* Whether other compilers can handle class Y above; is this a g++ bug?

			Thanks,

				- Fritz
				  fritz@mtl.mit.edu
Newsgroups: comp.lang.c++
From: krc@wam.umd.edu (Kevin R. Coombes)
Subject: Re: Overloading Operators
Organization: University of Maryland, College Park
Date: Mon, 25 Jan 1993 17:48:19 GMT

In article <2215@celia.UUCP> celia!gray@usc.edu (Steve Gray) writes:
>A const reference differs in a very important way from a plain reference:
>it clearly states that the member function has no side effects.  One of
>my (and others at R&H's) primary objections to using references is that
>it means member functions can have un-obvious side effects on their parameters. 
>i.e. they can change the contents of a variable which was passed by value (as 
>far as the caller's syntax is concerned) and therefor should not be changed by 
>the member function.
>
>We have basically outlawed non-const references as being too dangerous.  I
>personally would have preferred that they not even be allowed in the language,
>but I can understand why (given the syntax of the language) they are allowed.

Have you also outlawed pointers (to non-const objects) as parameters?

Kevin Coombes <krc@math.umd.edu>
From: cs89rdb@brunel.ac.uk (Roger D Binns)
Newsgroups: comp.lang.c++
Subject: Exceptions
Date: 22 Jan 93 19:20:19 GMT
Organization: Brunel University, Uxbridge, UK
X-Newsreader: TIN [version 1.1 PL8]

Can someone please give a brief overview of exceptions in C++, including a
very small example.  I have heard of them, but know nothing.

Roger
-- 
+=============================================================================+
| cs89rdb@brunel.ac.uk     Roger Binns    Brunel University - UK              |
|:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|
| Do your bit to destroy the American economy by overwhelming their legal     |
| system - buy an Intel chip to run your Lotus software TODAY.                |
+=============================================================================+
Xref: sparky comp.lang.c++:19668 comp.object:4968