HDTenEightyP/NetNews huggingface dataset:
From: "Philippe F. Bertrand" <pfbertra@watcgl.uwaterloo.ca>
Subject: a question about friend templates
Organization: Computer Graphics Lab [CGL], University of Waterloo
Date: Mon, 28 Sep 1992 15:16:28 GMT
X-Mailer: ELM [version 2.3 PL11]


suppose I have a class template defined as follows:

template<class A, class B> class C;

now I have a second class defined prior to class C as follows:

template<class D> class E {

    friend ....

};

I know that the following is valid inside E's declaration:

    friend class C<D,int>;	// only C<D,int> is a friend
      and
    template<class A, class B> friend class C; // all C<?,?> are friends

Can I specify that only classes C<D,?> are friends ?  That is the subset of
classes template<class A, class B> friend class C where A:=D ?

Please e-mail direct as I am not a regular subscriber to this news group.
Thanks for your time,
- Philippe F. Bertrand                          pfbertrand@watcgl.uwaterloo.ca 
Computer Graphics Lab, Department of Computer Science,
University of Waterloo, Waterloo, Canada  N2L 3G1
Newsgroups: comp.lang.c++
From: mcgrant@rascals.stanford.edu (Michael C. Grant)
Subject: valid template code?
Organization: Information Systems Laboratory, Stanford University
Date: 6 Oct 92 02:14:57


I've been exploring the possibility of templated member functions within
classes (both templated and non-templated). One example I considered was
an element-by-element replacement function:

template <class T>
class Vector {
   template <T(*func)(T)>
   void mapFunc(void) { for ( k = 0; k < len; k++ ) data[k] = func(data[k]); }
   void mapFunc(T(*func)(T)) { // same code as above }
}
typedef Vector<double> doubleVec;

Notice that I have both a templated and non-templated version, so
the following two functions would be functionally equivalent.

doubleVec A;
// code to fill A here
A.mapFunc<&sin>(); //OR
A.mapFunc(&sin);

The reason I would like to choose is that I can imagine a situation in
which the function passed to mapFunc could be in-lined in the templated
case, but certainly could not be inlined in the other case, for a 
possible increase in performance. Of course, the non-inlined version
is important when run-time determination of the mapping function is
necessary.

First of all, my only reference for templates is the ARM, and I don't
quite yet have cfront 3.0 to try these out. So I ask:
1) is this construct legal? How about the usage syntax?
2) is it reasonable to expect the templated version to optimally handle
   inline functions?
3) Does cfront3.0 or g++2.? handle such constructs? Optimally?

Here's another trick I'd like to be able to accomplish, but unfortunately I
imagine that the forward referencing may make this one difficult. But, I
see no reason why it can't be legal. This, of course, is a wrapper for the
scalar data types... my goal is to include as much of the automatic type
conversion for the built-in data types into the class:

template <class T>
class Scalar {
    static int level;
    static T default;
    T val;
public:
    Scalar( void ) : val(default) {}
    Scalar& operator=( const Scalar& p ) { val  p.val; return *this; }
    template <class U>
        Scalar( U p ) : val(p) {}
    template <class U>
        Scalar( const Scalar<U>& p ) : val(p.val) { return *this; }
    template <class U>
        operator U() { return (U)val; }
    // add the requisite operations, +, -, etc.
}

I would expect Scalar( U p ) and Scalar( const Scalar<U>& ) (these are
probably redundant, correct?) to be instantiated ONLY when p can be
AUTOMATICALLY cast from U to T; and I would expect operator U() to be
instantiated whenever val can be cast EXPLICITLY from T to U, and
cause a compiler error otherwise.

So, what about this one?  Obviously my goal is to provide such automatic
conversions for data types like Matrix<double> to Matrix<complex>, etc.
The instantiation issues here are much more complex, certainly.

Michael C. Grant
mcgrant@isl.stanford.edu
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c++
Subject: downcasting (was Re: GOTOo wars)
Date: 30 Sep 92 23:34:31 GMT
Organization: negligable

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

>	I've presented thoughts against downcasting, for example.
>Doesn't mean I'm against it. Means I'm concerned, and want--actually
>desire--that someone will show me my concerns are unjustified.
>But I dont go around saying anyone believing in downcasting
>is stupid. Hell, they might be right :-)

We're using the NIH Linked List.  When you get something off
the list it is just an Object *.  To actually use it you have
to downcast it to it's proper (and hopefully Object-derived :)
class.  If someone knows a way around this, please let me know
and I will *gladly* give up my use of castdown......

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Did you think it's a joke?		|
Well that's all right, do what 		|	-Richard Hartman
you want to do.				|	hartman@uLogic.COM
I've said my piece, now I 		|
leave it all up to you.			|
Newsgroups: comp.lang.c++
From: aldavi01@starbase.spd.louisville.edu (Arlie Davis)
Subject: Help!  Huge class declarations are degrading cfront performance.
Date: Tue, 29 Sep 1992 03:21:03 GMT
Organization: University of Louisville

Is there a way to speed up compile time?  My class declarations are getting
very large, and I think this is bogging down my compile time.  Compiling
a file that consists of including the main set of class declarations *and
nothing else* is taking more than a minute.  (I'm using HP9000/730s and an
HP9000/750, HPUX8.07, and HP's cfront.)  The load avg doesn't budge much,
and we've usually got quite a lot of CPU time and memory to spare.  Is there a
way to make cfront *more* greedy, i.e., use more memory for greater speed?
Or any certain way of layout out class declarations so that they compile
faster?  (I find myself longing for pre-compiled header files.)

Thanks in advance for any help.

-- 
lrwx------   1 aldavi01 emacsstu       9 Jun  6 12:43 .signature -> /dev/null
Newsgroups: comp.lang.c++
From: vcsc502@sfsuvax1.sfsu.edu (Dominik Vltavsky)
Subject: Recommendation Turbo C++ for Windows
Originator: vcsc502@sfsuvax1.sfsu.edu
Organization: San Francisco State University
Date: Mon, 28 Sep 1992 02:32:11 GMT


D
D
D
I have Borland Turbo C++ 3.0 for Windows and I heard that Borland came
with version 3.1 so I asked my computer dealer what is the differece
between v3.0 vs. v3.1. And he said " In Version 3.1 you can use various
colors to write you program" I don't think that's not enough to make
myself send $50 for upgrade. 

Can somebody tell  me what's the real differece 3.0 v 3.1.

     Thank you in advance ........Dominik k. 

You can mail me vcsc502@sfsuvax1.sfsu.edu u 
Newsgroups: comp.lang.c++
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: Exception handling & Borland C++ 3.1
Organization: Texas Instruments Inc
Date: Mon, 28 Sep 1992 17:55:10 GMT

In <1992Sep27.231910.1@jaguar.uofs.edu> das11@jaguar.uofs.edu writes:


>From :        David A. Sobeski
>              University of Scranton & Shared Research Corporation
>              das11@jaguar.ucs.uofs.edu

>Description : I am creating a generic stack package.  In this package I would
>              like to use exceptions as defined by Bjarne Stroustrup in his
>              book The C++ Programming Language (pg 293 - 324).

>              I am using BORALAND C++ Version 3.1 for Windows.  Nowhere within
>              its documentation does it mention try, throw, and catch. 
>              However, if you type these words in, the editor will boldface
>              them as if they are apart of the language.

>              When using a throw within a class, I get the error that I can
>              not define a throw in an inline function.  Also, when I put a
>              try in the source, it tells me illegal syntax.

>Question :    Does anyone know how BORLAND C++ handles exceptions?

I don't believe that BCC currently supports exceptions.  They are
undoubtedly in the process of implementing them, which probably
explains why they are recognized by the IDE as keywords, etc.  I
believe that the current version of MSC supports exceptions, but I
think they are done as a macro and hence don't really conform to the
way exceptions should be expected to act.

-- 
"Insisting on perfect safety is for people who don't have the balls to live
 in the real world."   -- Mary Shafer, NASA Ames Dryden
------------------------------------------------------------------------------
Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
From: heilig@plains.NoDak.edu (Zachary Heilig)
Newsgroups: comp.lang.c++
Subject: question about delete
Date: 2 Oct 92 20:50:50 GMT
Organization: North Dakota Higher Education Computing Network

Hello again

why does foo != NULL in the following example.  You would think that since
I deleted foo it would be NULL, or at least still point to the same spot
in memory, but evidentally, it doesn't even do that.  Where is foo pointing?

Script started on Fri Oct  2 15:44:15 1992
$ g++-2.0 test2.cc
$ a.out
foo = bar
foo is not NULL after delete.
foo = 
$ 

script done on Fri Oct  2 15:44:17 1992

here's the source:

#include <ostream.h>
#include <string.h>
#include <stdlib.h>

main()
{
	char	*foo;
	foo = new char[4];
	strcpy( foo, "bar" );
	cout << "foo = " << foo << '\n';
	delete [4] foo;
	if( foo == NULL )
		cout << "foo is NULL after delete.\n";
	else
		cout << "foo is not NULL after delete.\n";

	cout << "foo = " << foo << '\n';
	return 0;
}
-- 
    - Zach Heilig (heilig@plains.nodak.edu)

Ninety-Ninety Rule of Project Schedules:
	The first ninety percent of the task takes ninety percent of
	the time, and the last ten percent takes the other ninety
	percent.
From: checker@acf5.NYU.EDU (checker)
Newsgroups: comp.lang.c++
Subject: Re: Problem with overloaded * operator
Date: 2 Oct 92 04:21:11 GMT
Organization: New York University

srlncnc@gopher.dosli.govt.nz (Chris Crook) writes:
>The problem I have is trying to understand the effect of an overloaded "*"
>operator (as used in this case by Borland C++ ).  It is illustrated by the
>code below, which defines a string class containing a pointer to a character.
>The dereferencing operator "*" is overloaded to return the character pointer.
>    operator const char *() const;

This is actually a user-defined type conversion, not an overload of
operator* (unary dereference or binary multiplication).  It means that
the string object can be turned into a pointer to a constant character.

>    String a("The text");
>    cout << "a is \"" << *a << "\"\n";

a is being converted to a pointer to a char, then you dereference that,
which yields the character pointed to.

Chris

Newsgroups: comp.lang.c++
From: operator@julian.uwo.ca (Operator)
Subject: can != be used in compound if
Organization: University of Western Ontario, London
Date: Mon, 28 Sep 1992 19:54:25 GMT


can -- not equal (!=) -- be used in a compound if statement???


rnum is a random number generated by random()
number_set[] is an array of 6 integers


if (rnum != number_set[1] && rnum != number_set[2] && rnum != number_set[3])


is this if statement correct because the computer has been hanging on it

if it is not right, then can someone tell me what is wrong with it????
your help is GREATLY appreciated!!!

Thanks in advance!!!
From: jordan@aero.org (Larry M. Jordan)
Newsgroups: comp.lang.c++
Subject: New Zortech C++ Release?
Date: 29 Sep 1992 21:17:52 GMT
Organization: The Aerospace Corporation
NNTP-Posting-Host: uniblab.aero.org

Yesterday I received a copy of "Programmer's Paradise" in the mail and noticed
an ad for a verion of Zortech C++ for OS/2 that supports the AT&T v3.0 standard,
including templates.  I did not find a similar ad for DOS or WINDOWS.

I'm confused.  Did PP jump the gun?  Is a version of Zortech which supports
templates imminent?  How much longer must I wait?  (If something doesn't happen
soon I'll just buy a copy of Turbo C++ for Windows and be done with it.)

--Larry

Newsgroups: comp.lang.c++
From: pete@genghis.borland.com (Pete Becker)
Subject: Re: declare keyword, type inference
Originator: pete@genghis.borland.com
Organization: Borland International
Date: Mon, 5 Oct 1992 16:08:35 GMT

In article <9227912.20161@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
>>
>>Does this buy anything over
>>
>>	template <class T> class Foo: public Array<Array<T> > { }
>
>Yes. The poorly named "typedef" creates a type alias, whereas
>public derivation creates a distinct new class.
>
>Apart from the difficulties of mixing Foo<t> and Array<Array<t> >,
>the typedef actually saves global data space, since the public derivation
>approach requires the compiler to emit a vtable for each of the Foo<t> classes.

	The compiler is not required to emit a vtable for each of the Foo<T>
classes.  There's nothing in the language that prohibits sharing of vtables,
assuming, of course, that that is how virtual function dispatching is
implemented.
	-- Pete
Xref: sparky comp.lang.c++:14233 gnu.g++.help:1283
From: brendan@cygnus.com (Brendan Kehoe)
Newsgroups: comp.lang.c++,gnu.g++.help
Subject: Re: Interaction templates/const member functions
Date: 28 Sep 92 13:46:17 GMT
Reply-To: brendan@cygnus.com
Distribution: usa
Organization: Cygnus Support, Palo Alto, CA
In-reply-to: pjl@sparc10.cs.uiuc.edu's message of Fri, 25 Sep 1992 13:43:47 GMT

In article <1992Sep25.134347.3603@sunb10.cs.uiuc.edu> pjl@sparc10.cs.uiuc.edu (Paul Lucas) writes:

   In <1992Sep24.213609.25858@CS.ORST.EDU> budd@fog.CS.ORST.EDU (Tim Budd) writes:

   >Don't know if this is a bug in g++ (version 2.2) but it seems to
   >disagree with my reading of the ARM.  This has to do with an odd
   >iteraction between template classes and constant member functions.

   	   Yes; use AT&T C++ 3.0.  It compilies your code with only a warning
	   about your c'tor not having a const T& when you pass a 5 to it
	   since it has to create a temporary.

This is absolutely not the right solution.  You're first, paying for
software, and second, paying USL, whose attack on all of the free
computing world by suing BSDI and the regents of UCB for their
collective work is decidedly unfriendly.

Rather, wait until GCC 2.3 (early October), where this bug is fixed,
and continue to enjoy the rights of using free (including full source
code).

Rather than pay for software, report clear coherent bugs (for G++,
write to bug-g++@prep.ai.mit.edu) and we'll do our best to fix them.

Brendan
--
Brendan Kehoe                                               brendan@cygnus.com
Cygnus Support, Palo Alto, CA                                  +1 415 322 3811
                                                 Re-elect Clinton/Gore in '96!
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c++
Subject: Re: declare keyword, type inference
Date: 5 Oct 92 16:00:08 GMT
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Murray Hill NJ

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

> 	This would only be legal if 

> 	int x = f(&x);

> was legal. Surely you cant initialise a variable with itself like this?

Unfortunately, the declaration above is legal C, so it is hard to
justify not making it legal C++.

Such things are usually pathological, but sometimes even useful:

	struct circlist {
		circlist *next;
		void *data;
	};

	struct circlist head = { &head, 0 };
-- 
				--Andrew Koenig
				  ark@europa.att.com
Newsgroups: comp.lang.c++,comp.std.c++
From: pete@genghis.borland.com (Pete Becker)
Subject: Re: The concept of templates considered ill designed
Originator: pete@genghis.borland.com
Organization: Borland International
Date: Tue, 6 Oct 1992 17:27:54 GMT

In article <Yeo91je00awVE_zEkI@andrew.cmu.edu> osoelgaultier+@CMU.EDU (Stefan Monnier) writes:
>
>With inheritance constraints, you can restrict method calls
>to those known to be present (through inheritance).
>Inlining doesn't make it impossible: it's just harder, cause
>you can't keep the compiled version in pure object code, but
>you have to keep information on where are the 'parameters' used
>in order to translate their use !
>
>What I say is just that inheritance constraint permits to check
>the file and compile it before using it !
>

	Constrained inheritance in combination with compiling before use
also constrains you to a subset of the current template functionality which
can be implemented without any notion of templates.  All you have to do is
write a class that uses pointers to the actual object, and restricts its
method calls to those "known to be present".  One of the major benefits of
templates arises precisely because they depend on the actual class used: the
compiler can generate much better code when it "knows" what it's dealing with.
	-- Pete
From: engelsma@borzoi.cps.msu.edu (Jonathan Engelsma )
Newsgroups: comp.lang.c++
Subject: C++ Task Library/Real Time Cntrl
Date: 1 Oct 92 20:09:57 GMT
Followup-To: comp.lang.c++
Organization: Dept. of Computer Science, Michigan State University

Has anybody sucessfully used the interrupt handling facility provided
in the AT&T C++ tasking library?

I seem to be able to catch the interrupts, but if there is any other
tasks waiting on a delay() call, I get a run-time error.  According 
to the manual my run-chain is corrupted.

Below is a very simple program that gives me the problem.  It consists
of a single interrupt handler which will wait for a ^C.   The main
loop will just sit and spin, delaying for one simulation time unit
per iteration.  The interrupt handler will just print a brief message
whenever you press cntrl-c.  If I comment out the thistask->delay(1.0)
statement in the main routine, the program works fine.  Am I doing
something wrong? 

Any comments/corrections/suggestions would be greatly appreciated.

Jon

-----------------------demo.cc---------------------------
// to compile: CC demo.cc -ltask
#include <task.h>
#include <iostream.h>
#define clock (sched::get_clock())

class CntrlChandler : public Interrupt_handler {
    void interrupt();
public:
    CntrlChandler() ;
};

void CntrlChandler::interrupt()
{
    cout << "yippee, I caught a ^C at t=" << clock << endl  << flush;
}

CntrlChandler::CntrlChandler() : Interrupt_handler(SIGINT) { }

CntrlChandler chand;

main()
{
    while(1) {
        thistask->delay(1.0);
        cout << "Main delaying: t=" << clock << endl << flush;
    }
}




 
Newsgroups: comp.lang.c++
From: pkoch@news.weeg.uiowa.edu (Peter F Koch)
Subject: Looking for SQL class library
Organization: University of Iowa, Iowa City, IA, USA
Distribution: usa
Date: Tue, 6 Oct 1992 18:26:39 GMT

I'm looking for a SQL class library preferably one that works with Oracle
embedded SQL (either public domain or vendor). 
Newsgroups: comp.lang.c++
From: feustel@netcom.com (David Feustel)
Subject: Re: Persistance Problem Solved by Memory-Mapped Files?
Date: Tue, 29 Sep 92 23:54:31 GMT
Organization: DAFCO: OS/2 Software Support & Consulting

I should add that I was thinking of memory-mapped files where the 
memory mapped to is a file-specific 386 segment(i.e. 4 gigabytes of
addressible data space including no code).
-- 
Dave Feustel N9MYI <feustel@netcom.com>
 
[.sig on vacation]
Xref: sparky comp.lang.c++:14514 comp.std.c++:1301
From: osoelgaultier+@CMU.EDU (Stefan Monnier)
Newsgroups: comp.lang.c++,comp.std.c++
Subject: Re: The concept of templates considered ill designed
Date: 4 Oct 92 21:40:17 GMT
Article-I.D.: andrew.0enxJ1W00awTMNepU8
	<23801@alice.att.com>
Organization: Junior, Math/Computer Science, Carnegie Mellon, Pittsburgh, PA

Excerpts from netnews.comp.lang.c++: 5-Oct-92 Re: The concept of
template.. Andrew Koenig@alice.att. (287)

> In article <Ienr=wm00awU8A=Ecc@andrew.cmu.edu> osoelgaultier+@CMU.EDU
> (Stefan Monnier) writes:

> > But the suggested 'templates with type constraint' would
> > permit to change it into an implementation issue.

> Really?  Why do you think so?
> -- 
> 				--Andrew Koenig
> 				  ark@europa.att.com


As are currently implemented templates, you don't know
anything about the actual type at compile-time.
So that no method calls or variable accesses can be compiled
for any variable of 'template type'.

The only thing you can do at compile-time with those variables
is to store them and retrieve them in a structure, but, again, 
without making them execute anything.

A hashtable (which requires the type to have at least a
'hash' method) couldn't be compiled, as the compiler 
can know where the 'hash' method will be in the actual type !

That's why Eiffel has those type constraints: it's not a feature,
it's just necessary to be able to compile it separately ! (and to
typecheck separately also)

	Stefan

-----------------------------------------------------
-- On the average, people seem to be acting normal --
-----------------------------------------------------
From: pluto@cs.ucsd.edu (Mark Plutowksi)
Newsgroups: comp.lang.c++
Subject: Re: Borland debugger w/ dual monitor system
Keywords: Borland,debugger
Date: 2 Oct 92 17:27:12 GMT

karhila@fmi.fi (Vesa Karhila) writes:

>And finally:
> 3) Does anybody know if Borland is going to release a Windows
>    version of its deBugger?  Any rumours?

>All experiences and info on working with dual monitors are welcome.
>Please e-mail to:
>                    vesa.karhila@fmi.fi
>  Vesa Karhila


According to a Borland employee directly involved in such matters,
the text-based debugger will be with us "for a while" 
although several improvements to it are in the works.

= Mark

-=-=
M.E. Plutowski,  pluto%cs@ucsd.edu 

UCSD,  Computer Science and Engineering 0114
9500 Gilman Drive
La Jolla, California 92093-0114
Newsgroups: comp.lang.c++
From: morss@ssd.kodak.com (Charlie Morss)
Subject: Access to file descriptor within fstream class?
Organization: Eastman Kodak
Date: Mon, 5 Oct 92 17:30:48 GMT


I recently asked a question in regard to record locking using
the fstream class. Steve Clamage replied and suggested that
I derive a class from fstream called lfstream in which I could
then have a lock and unlock member function. Now the question
is how do you get the file descriptor from the fstream class? 

I've looked around at the some manuals and both Stroustrup and 
Lippman and haven't found anything. Does anyone know how to do this?

Thanks in advance,

Charlie

-- 
-----------------------------------------------------------------
Charlie Morss                               Voice: (716) 726-5461
morss@eksignal.kodak.com                      Fax: (716) 726-4850 
-----------------------------------------------------------------
From: thacker@enh.nist.gov
Newsgroups: comp.lang.c++
Subject: scientific object-oriented programming?
Date: 30 Sep 92 19:58:44 GMT
Organization: NIST

I'm interested in writting fluid-dynamic codes in an object-oriented
style and would like to see examples of codes that might help me in 
designing classes for scalar and vector fields.  In particular, I'm 
involved with oceanographic problems where it is necessary to 
distinguish computational cells associated with water from those 
associated with land, and there are technical problems associated with 
some fields being defined at cell centers, others at cell faces, etc.  
In addition, I am trying to design for inverse problems and must 
implement adjoint operators for each differential operator that is 
introduced.

I would greatly appreciate all suggestions and examples of scientific 
codes written in o-o style and opinions as to whether o-o style is 
appropriate for such computations.  Also, opinions as to c++ (and/or 
fortran90) being appropriate.

Thanks,

Carlisle Thacker
Newsgroups: comp.lang.c++,comp.std.c++