HDTenEightyP/NetNews huggingface dataset:
From: jonas@beppe.ericsson.se (Jonas Nygren)
Subject: Re: destruction of temporaries
Reply-To: jonas@beppe.ericsson.se
Organization: Ericsson Telecom AB
Date: Tue, 18 Aug 1992 07:11:16 GMT

In article 23466@alice.att.com, ark@alice.att.com (Andrew Koenig) writes:
> In article <1992Aug17.073500.24115@ericsson.se> jonas@beppe.ericsson.se writes:
> 
> > IMO temporaries should survive until end of statement.
> 
> This treatment has two significant disadvantages:
> 
> 	1. If I break a statement up into several, it may
> 	   quietly change its meaning.  Thus, for example, if
> 	   String::operator const char*() exists, and s and t are
> 	   of class String, then
> 
> 		printf("%s\n", (const char*)(s+t));
> 	
> 	   might work but
> 
> 		const char* r = s + t;
> 		printf("%s\n", r);
> 	   
> 	   might not.

Here the programmer must be aware that a conversion takes place and should take
necessary actions. Though, I agree it isn't obvious until you have had this bug.

> 
> 	2. It is a real pain to implement for statements that
> 	   generate temporaries inside conditionals.  Thus, for
> 	   example, in x>0?f(p+q):r, if p+q generates a temporary,
> 	   and it was necessary to wait until the end of the statement
> 	   to destroy it, it would also be necessary to remember which
> 	   branch of the ?: was taken to decide whether or not to
> 	   destroy it.  There are cases where this can add substantially
> 	   to execution time.  Moreover, it greately complicates the
> 	   implementation of exception handling, because it makes it
> 	   impossible to have a static map from program counter value
> 	   to offsets of statics to destroy.

I get very suspicious when I here about how difficult things are to do in a compiler, e.g. 
I can't accept that extra space in templates x<y<int> > which is claimed to be so difficult to solve. 
(I have never received so many replies as to the article where I claimed this to be a bug).

Without any compiler experience I solved this in gcc with one days work. Think of all irritation
it causes to forget this little space, and how relatively simple it can be alleviated.

> 
> For these reasons, I think a shorter lifetime than end of statement
> is appropriate for temporaries.  Whether the committee will go that
> way, however, remains to be seen.

Perhaps end of statement is not the correct point for destruction of temporaries but I hope you agree
that the small example I showed where:

	s2 = s1.sub(2,3);

works, but not

	s2 = s1.sub(2,3).strip();

is a bit to subtle to be acceptable. 

> -- 
> 				--Andrew Koenig
> 				  ark@europa.att.com


/jonas
From: asgeir@viking.asd.sgi.com (Asgeir Eiriksson)
Subject: libg++ and C++ V3.0
Organization:  Silicon Graphics, Inc.  Mountain View, CA
Date: Wed, 12 Aug 1992 21:25:38 GMT

Can libg++ be used with the AT&T derivative V3.0 (V2.1) C++?

What are the issues?

Thanks, 'Asgeir
From: mra@searchtech.com (Michael Almond)
Newsgroups: comp.lang.c++
Subject: Re: Question about Turbo Vision MessageBox
Date: 18 Aug 92 15:27:19 GMT
Organization: Search Technology, Inc.

In article <15754@star.cs.vu.nl> kwassin@cs.vu.nl (Wassink K) writes:
>I'm using Turbo Vision's  messageBox function, but am
>wondering if it's possible to change the texts on the buttons;
>In the msgbox.h file a class is defined mentioning things
>like yesText, cancelText, etc.
>Does anybody know how to change them, so I can say
>'Yes' and 'No' in other languages as well ?

The messageBox() uses the strings storage in 
	\borlandc\tvision\source\tvtext2.cpp

Just define yesText in one of you *.obj and TV will use your string
instead of the one in tv.lib.

-- 
Michael R. Almond (Georgia Tech Alumnus)          mra@srchtec.uucp (registered)
computer alli, inc.					    mra@searchtech.com
6000E dawson blvd.	      				    uupsi!srchtec!mra
norcross, georgia 30093				        (404) 840-1002 (office)
Newsgroups: comp.lang.c++
From: glw@io.uswest.com (Glenn Williams)
Subject: Re: How useless is Stroustrup's original book?
Organization: US WEST Communications
Distribution: usa
Date: Thu, 13 Aug 1992 15:41:23 GMT

Stan Lippman's C++ Primer is also a must. 

glenn williams
US WEST
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Garbage Collection for C++
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Sun, 16 Aug 1992 05:22:33 GMT

In article <1992Aug15.005542.3104@news.mentorg.com> bcannard@hppcb36.mentorg.com (Bob Cannard @ PCB x5565) writes:
>
>Reference counting suffers serious drawbacks:
>
>1. It can't handle cyclic data structures
>
>2. It is one of the most inefficient forms of garbage collection known to man.
>
>The main reason I'm pushing for true garbage collection is that I consider
>reference counting (which I already have) to be an unacceptably poor solution.

	Mm. Reference counting used to implement 'write on demand' in
copy contructors is supposedly inefficient. But this is not at all
the same as reference counting for garbage collection. In copy contructors,
you have to check the reference count before each write operation,
and if its not 1, clone off a copy of the object. Thats slow.

	But for GC you only have to increment the reference count
when you take the address of the object to form a GC pointer,
decrement it when the pointer is destroyed, and destroy the 
object when the count goes to 0. That doesn't seem to be so slow
to me: please correct me if I'm wrong.

	The basics of GC are that each object must be rooted.
Rooted normally means accessible via a static or auto pointer,
directly or indirectly. Non-rooted objects are garbage.

	The definition of rooted above is useless, however,
in modern Windowing systems. In Windows 3 for example,
the objects may be rooted in the operating system memory
for a Window, typically between events the user program
has no stack at all.

	In such systems we would have to be very careful using
stack scanning garbage collectors: they would fail totally.

	Interestingly, objects allocated under Windows
are already subject to automatic compaction, and even garbage
collection on a task by task basis.

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
From: cmhui@cucs18.cs.cuhk.hk (Hui Chau Man)
Newsgroups: comp.lang.c++
Subject: Oasys contact wanted
Date: 14 Aug 92 02:40:42 GMT
Organization: Faculty of Engineering, The Chinese U. of Hong Kong

Dear netters,

Can anybody tell me the contact FAX number of Oasys. Oasys is the
developer of Green Hill C and Green Hill C++ compiler.

Thanks in advance.


C.M. Hui
Dept. of Computer Science
The Chinese University of Hongkong
Shatin, N.T.
Hongkong

Internet: cmhui@cucs18.cs.cuhk.hk
FAX: (852) 6035024
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Newsgroups: comp.lang.c++
Subject: Re: Downcasting (was: Re: run-time type checking)
Date: 14 Aug 92 23:23:22 GMT
Organization: MAXTAL P/L C/- University Computing Centre, Sydney

In article <4820@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
>maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>:
>:There are other ways than tagged pointers to make downcasting
>:sound. One might be to declare the derived classes that you want
>:to downcast to in the base class FROM which you want to downcast:
>:	class Base { //....
>:		operator Derived1*() =0;
>:		operator Derived2*() =0;
>:	};
>:Now what does this do? Well, it preserved th open/closed principle
>:and encapsulation and the explicit interfaces principle.
>
>What if someone using your classes decides to add a Derived3 class
>to which downcasting should be possible?  He must modifiy your
>class Base, for which he may not have source code.
>
>Does not (help) preserve the open/closed principle at all, IMHO.

You said it: he MUST reopen Base. Thats WHY it preserves the open/closed
principle. If the Base is locked away (no source, in a library)
it is CLOSED permanently and cannot be reopened, so you CANT
get at the new derived3 class with a downcast using the above
technique, because that would violate the closure of Base.

It is this very observation cojoined with the fact that with downcasting
the restriction does not exist, that lead me to suspect that
downcasting violates the open/closed principle.

It is precisely because you can extend (in the above sense) the base
WITHOUT reopening it. Just adding a new derived class does NOT require
this---it is polymorphism, it is using inheritance and it is
in fact a consequence of the open/closed principle. Being able
to add or not add and ARBITRARY derived class. A derived class
you downcast to is not arbitrary, its not polymorphic but
heteromorphic (one of a specific set of distinguished objects).


-- 
;----------------------------------------------------------------------
        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: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Dumb questions about Borland C++
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Thu, 13 Aug 1992 15:24:05 GMT

In article <q!3m8wf.sjk@netcom.com> sjk@netcom.com (Shel Kaphan) writes:
>I've been trying to port some programs written for a Unix C compiler
>to Borland C/C++, and have a few questions:
>
>- How do you add an assembly language file to a project in the Windows
>IDE ("Integrated Development Environment")?  I tried to do the obvious
>thing, and it claims to have successfully "compiled" the assembly
>files, but it turns out it didn't do anything.

	Just add the file to the project. Must have .ASM extension.
Never tried it but it should work. Otherwise you can configure
the project to specifically invole the assembler.
>
>- Is there a way to view the 386 registers in the debugger?  I mean
>those registers not already present in the 286 and 8086.

	No because they are not used.
>
>- When you put it into "K&R" mode, is there some special magic trick
>you have to do to make it not choke on its own header files?  (Like
>math.h and other obvious ones...)  I ended up using "protoize" from
>gnu C to convert the programs to use ANSI function prototypes,
>and then feeding it through the Borland C++ compiler...

	I have noticed that the preprocessor macro __STDC__
is incorrectly tested with !__STDC__ when in fact it is either
defined or not defined, rather than being defined as 1 or 0.
You might look at that.
>
>- Isn't there some way to tell it that you want "int" and "unsigned int"
>to be 32 bits?   (just wishful thinking).

	#define long int :-)

>
>- Is there no memory model on the PC in which the stack can occupy
>more than 64K bytes?  (more wishful thinking, I know ... don't flame me.) 
>Don't ask why I care.

	No. Its only a 16 bit machine. And the 386 still
runs 16 bit operating systems.
>
>I'd ask them directly, but after most of an hour waiting for them to
>answer their technical service phone number, I figured this would be faster.


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
From: jac@moonshine.llnl.gov (James A. Crotinger)
Newsgroups: comp.lang.c++
Subject: Re: Que: Double-Precision Complex Arrays
Date: 18 Aug 92 00:56:20 GMT
Organization: Magnetic Fusion Energy - LLNL

K3006E7@ALIJKU11.BITNET writes: 

> How does one declare a complex array?
>   static complex array_name[2][2];
> doesn't work, for example.

  I think the problem is that the AT&T complex class doesn't 
have a complex::complex() constructor. Rather, I think it has
complex::complex(float re=0.0, float im=0.0), and in some older
implementations, this latter constructor could not be used in
the construction of arrays. Although it is a hack, I think you
can fix the problem by editing <complex.h> and adding an inline
complex::complex() constructor which simply initializes the 
members to zero.

  BTW, a better solution is to write a ComplexMatrix class (or
Matrix<complex> if you have templates). C "Arrays" suck.

> 2) How does one declare double precision complex numbers?  And
> double precision complex arrays?  Does one have to fiddle with
> the complex.h file itself in order to get double precision?

  The Sun C++ (AT&T CFRONT) complex.h is based on "double". If yours
isn't, fixing things will be more complex 8-) than just modifying
complex.h.


  Jim

--
-------------------------------------------------/\--------------------------
James A. Crotinger     Lawrence Livermore N'Lab // \ The above views are mine
jac@moonshine.llnl.gov P.O. Box 808;  L-630 \\ //---\  and are not neces-
(510) 422-0259         Livermore CA  94550   \\/Amiga\  sarily those of LLNL.
Organization: Johannes Kepler University Linz - Computing Center
Date: Monday, 17 Aug 1992 13:05:33 CDT
From: <K3006E7@ALIJKU11.BITNET>
Newsgroups: comp.lang.c++
Subject: Question: Complex Arrays

I am new to C++ so please forgive me if these questions are irritatingly
elementary.  But if anyone could offer suggestions or answers, I would
greatly appreciate it!

In my program, I already have included <complex.h> that comes with
the C++ package.  But when I try to create an array of complex numbers,
the compiler issues an error.  How does one declare a complex array?

static complex set
Newsgroups: comp.lang.c++
From: leo@avs.com (Leo O'Donnell)
Subject: Function Prototyper - I need one
Organization: Advanced Visual Systems Inc.
X-Newsreader: Tin 1.1 PL4
Date: Thu, 13 Aug 1992 16:18:36 GMT
X-Posted-From: phobos.avs.com
X-Posted-Through: sol.ctr.columbia.edu

    Can anyone point me at a source for stand-alone program that 
    generates function prototypes for functions that have old-style
    definitions.

    Thanks,

Leo O'Donnell                Email: leo@avs.com
Advanced Visual Systems      Voice: (617) 890-4300 ext 2120
Waltham, MA
From: jonas@beppe.ericsson.se (Jonas Nygren)
Newsgroups: comp.lang.c++
Subject: Re: destruction of temporaries
Date: 19 Aug 92 11:35:54 GMT
Reply-To: jonas@beppe.ericsson.se
Organization: Ericsson Telecom AB

In article 92Aug19113657@arolla.idiap.ch, tmb@arolla.idiap.ch (Thomas M. Breuel) writes:
> In article <1992Aug18.205211.16789@Warren.MENTORG.COM> adk@Warren.MENTORG.COM (Ajay Kamdar) writes:
> 
>    So why would the ARM consider the example with a temporary sufficient
>    reason to reject the "end of function" approach? To me it appears that
>    the "end of function" approach for temporaries would not cause any more
>    difficulties or program bugs than those that can already occur even without
>    temporaries. So why not reconsider that approach?
> 
> I don't want my temporaries to hang around until the end of the
> function. I often use large temporaries (megabytes), and I see no
> reason why they should stick around any longer than I need them.
> 
> Temporaries should get destroyed as soon as their value has been used.

Yes used is the right word. I gave a small example in a previous posting where

	s2 = s1.sub(2,3);

is OK, but

	s2 = s1.sub(2,3).strip();

is not. Why should this use be disallowed??

> To make call-by-reference a little more convenient, there is a special
> rule for binding references to temporaries, and I guess that's OK.

Why is this use OK, on what is your 'guessing' based??

> 
> The properties of temporaries are no different (and no worse) than the
> properties of automatic variables: pointers to them become invalid
> when the object disappears.

This is obvious. What we are discussing are when temporaries should disappear.

> 
> If you want to be able to implement anything more powerful, you need
> (surprise!) garbage collection (as stated in the ARM, p. 268). In the

If you read the referenced pages closely there are many points of destruction
which are discussed and each giving some more 'power'. The ultimate solution
might be GC. But without GC in the language we could try to make the language
more 'intuitive' by  defining a reasonable behaviour for temporaries.

> presence of GC, you would then actually have a choice of destroying
> the temporary yourself (the current situation, safe if no pointers to
> it have been handed out), or of not destroying it at the end of the
> expression and letting the GC take care of it.
> 
> 					Thomas.


/jonas
From: pfander@kommu.UUCP (Dr Gotthard Pfander)
Newsgroups: comp.lang.c++
Subject: Messaging across process boundaries under C++
Keywords: RPC, C++, Messaging
Date: 20 Aug 92 12:57:30 GMT

We are looking for experiences and suggestions on message-passing
inside and between different processes. So kind of a 'Message-RPC'.

That is a mechanism to interchange messages between objects located
inside different processes or even on different hosts.

This problem must have been solved a number of times, but now here are the
restricions:  it must be compatible with C++ in some way.

Some of the more subtle problems, that will occur:

-	C++ has no clean and easy way to access its message dispatching.
	(functions under use have to be virtual to begin with)

-	Pointers a such do not suffice to identify objects, one needs a
	naming system across processes (global namespace).

-	Simply extending a standard communication mechanism like 
	(SUN-) RPC or similar will not work, because messages between
	objects might get recursive, when seen from the involved proceesses.

	For example: object A in process 1 will send a message to
	object B in process 2, which in turn will send a message to
	object C in process 1, but there is process 1 waiting for
	the result of the first message.

Some really weired idea: redefining the . (dot) and -> operators and
building in a communications-protocoll. But how?

In case I will get some reasonable replies, i will bundle and repost them.

pfander@kommu.erls01.siemens.de

Gotthard Pfander
SIEMENS AG, ANL A 593
Werner von Siemens Str. 50
D W8520 Erlangen
Tel +49/9131/7-28711
Newsgroups: comp.lang.c++
From: rjackson@gmuvax2.gmu.edu (Richard L Jackson Jr)
Subject: Has anyone ported USL (AT&T) 3.0.1 C++ to ULTRIX 4.1?
Organization: George Mason University, Fairfax, Va.
Date: Tue, 18 Aug 1992 16:51:03 GMT

I have a VAX 8530 running ULTRIX 4.1.  Has anyone ported USL (old AT&T)
3.0.1 to ULTRIX 4.1?  ULTRIX 4.1, and I believe 4.2, are based off
of 4.2BSD with DEC 'enhancements' added.  Thank you in advance.

Richard Jackson
Xref: sparky comp.lang.c++:12494 gnu.emacs.help:3761
From: eedksc@aachen.ericsson.se (Klaus Schniedergers)
Newsgroups: comp.lang.c++,gnu.emacs.help
Subject: Re: emacs tags for C++ source files.
Date: 18 Aug 92 09:59:56 GMT
Organization: Ericsson Eurolab Deutschland GmbH

In article <1992Aug17.185439.18558@Warren.MENTORG.COM>, sharma@euler.Warren.MENTORG.COM (Sharma Kunapalli) writes:
|> Hi All,
|> 
|> Is there a emacs tags program that will work with
|> C++ sources?
|> 
|> Thanks.
|> 
|> Sharma

There is a package for emacs called 'c++-browse'.
It includes an enhanced and backward compatible etags program.
You can find it on many ftp-servers, which have emacs-sources, too.
Or ask archie....
klaus


-- 
-------------------------------------------------------------------------------
Klaus Schniedergers                 
                                   
EED/B                              Fax: +49 2407 575-150
Ericsson Eurolab Deutschland GmbH  Twisted Pair: +49 2407 575-147
Ericsson-Allee 1                   Email: eedksc@aachen.ericsson.se (preferred)
D-5120 Herzogenrath                Memo:  EED.EEDKSC
-------------------------------------------------------------------------------
From: esper@cs35b.cs.umn.edu (Dave Sherohman)
Newsgroups: comp.lang.c++
Subject: Stream I/O in Turbo C++
Date: 16 Aug 92 02:33:18 GMT
Organization: University of Minnesota

OK, another question for you.  (As was guessed after my last one, I'm fairly
new to C++... BTW, the actual problem with the struc claiming to have been
redefined was that the .h file it was in was included twice into one .cpp
file...  Oops...)  I'm playing with mixing windowing and stream I/O, and I
can't figure out how to get the window to scroll properly.  When I hit the
bottom of the window, 'cprintf("\r\n");' will send a linefeed and scroll the
window up one line, but 'cout << "\r\n";' wraps the cursor back to the top
of the screen instead of scrolling it.  How can I get the scrolling to work
without resorting to using cprintf?

esper@ima.umn.edu
From: aldavi01@starbase.spd.louisville.edu (Arlie Davis)
Newsgroups: comp.lang.c++
Subject: Tiny proposal for named loops.
Date: 21 Aug 92 05:48:00 GMT
Organization: University of Louisville

Since the language is still open to improvements, even those which relate to
the more C-oriented personality of C++, I'd like to suggest the addition
of named loops.  The syntax would not break any existing code at all.
An identifier would be placed just after the "for", "while", "do", or even
"if" keyword.  This keyword could be used just after "break" or "continue",
to specify exactly which loop to break or continue.

Example:

for main_loop (...)
  // ...
  for inner_loop (...)
    // ... complex mess of loops ...
          break main_loop;       // somewhere deep inside the loops
    // ...
          continue inner_loop;   // similarly, deep inside loops


This would eliminate the need for some state variables used with switches,
which would make code more readable, and more block-oriented.

Yes, it's a structured goto.  But so are break and continue in the first place
-- this is an improvement of them.

Any comments in email, please.

-- 
lrwx------   1 aldavi01 emacsstu       9 Jun  6 12:43 .signature -> /dev/null
Newsgroups: comp.lang.c++,comp.windows.x,comp.windows.x.motif
From: ringer@oahu.cs.ucla.edu (Brian Ringer)
Subject: Looking for Solbourne OI library
Originator: ringer@oahu.cs.ucla.edu
Organization: UCLA Computer Science Department
Distribution: na
Date: Tue, 18 Aug 92 18:43:35 GMT

Hi.  I'm looking for information about how to get the Solbourne OI C++ 
library, either directly from Solbourne or via a second party vendor.  

Brian
From: rwk@silver.sbi.com (Richard W. Kreutzer Consultant)
Newsgroups: comp.lang.c++
Subject: rpc++
Date: 21 Aug 92 21:43:59 GMT
Distribution: comp
Organization: Olympus Software, Inc.

The Qualix Group refer to an RPC library in their promotional blurb in the C++
Producte List published by  wagner@ike.ucdavis.edu (John Wagner):

	* Development environment: 
	The GNU development utilities from the Free Software
	Foundation, including: 
	the gcc 2.1 compiler, gdb debugger, xxgdb 
	windows interface to gdb, libg++ base classes, 
	binutils, bison parser, gas assembler, and other 
	utilities.
	* Tutorial material:
	"Programming in C++" by Dewhurst and Stark: an excellent
	textbook for those learning C++
	"C++ Tutor": an on-line tutorial with many examples
	"C++ Frequently Asked Questions": a Q&A document
	* Examples:
	Sample class libraries including: a vector class library,
===>	an RPC library, InterViews, a class library for GUI 
	development, and Xv++ - a demonstration version of a 
	C++ interface to Xview 3.0.

Does anyone know what this is and where they got it from?

Maybe someone from Qualix could respond.

Thanks, Dick
--

--
        Richard W. (Dick) Kreutzer
Net:    rwk@quark.sbi.com				CIS:	70702,2174
Voice:  +1(801)571-2446					FAX:	+1(801)571-2448
Mail:   Integra Software Corp.; 1378 Jasmine Avenue; Sandy, UT 84092 (USA)
Newsgroups: comp.lang.c++