HDTenEightyP/NetNews huggingface dataset:
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Downcasting
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Tue, 29 Sep 1992 14:47:14 GMT

In article <1992Sep28.153045.13422@cadsun.corp.mot.com> shang@corp.mot.com writes:
>In article <1992Sep25.154501.10007@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU  
>(John MAX Skaller) writes:
>> 	1) Suppose the Q manager enQs and deQs things, for example,
>> it might want to move some items from one queue to another. It uses
>> the 'Q' class. I want enQ and deQ to be public members of Q.
>> I also want 'getsome(NQ&)' and 'putsome(DQ&)' to restrict the operations.
>> 
>> 	2) Is protected inheritance actually legal? It is not
>> mentioned in the text of CH11 that I can see, yet it is implied
>> by the syntax and supported by Borland.
>> 
>> 	3) In your solution I could NOT call 'getsome(NQ&) because
>> upcasting is only allowed to a public base.
>> 
>
>Try this:
>
>class EQ
>{ public: virtual void enQ();
>};
>
>class DQ
>{ public: virtual void deQ();
>};
>
>class Q: public EQ, public DQ
>{
>  protected:
>    void enQ() {...};
>    void deQ() {...};
>  public:
>    // some queue management functions...
>};
>
>Q * q = new Q;
>EQ * eq = q;
>DE * dq = q;
>
>eq->enQ(); // okay;
>dq->deQ(); // okay;
>q->enQ();  // error: enQ is not accessible in Q
>q->deQ();  // error: deQ is not accessible in Q
>
>David Shang
>

	But this doesnt address the problem. Because given
downcasting and an EQ object I can downcast to Q then upcast to DQ,
and thus access both functions. I dont have to call it through
Q.

	Thus 

	f(EQ* eq){ NQ *nq= (NQ*)(Q*)eq; nq->enQ(); }
				^^^^
				downcast

	
-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
From: helie@bach.udel.edu (Ray Helie)
Newsgroups: comp.lang.c++
Subject: Microsoft C++ (v7.0) and Templates -- When?
Date: 7 Oct 92 02:35:50 GMT
Organization: University of Delaware

Sorry if this question was already asked -- Does anyone know if there
is an upgrade coming out any time soon for Microsoft C++ (v7.0) that
will include templates?  If so, could you tell me when?  Thanks in 
advance.


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   Ray Helie         8-)                   University Of Delaware
   [helie@bach.udel.edu]                   Newark, DE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   Project:  Flexible Abbreviation Expansion communication system       
             for disabled people.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Newsgroups: comp.lang.c++
From: shang@corp.mot.com (David (Lujun) Shang)
Subject: Re: Downcasting
Reply-To: shang@corp.mot.com
Organization: Motorola, Inc., Software Research and Development, Rolling Meadows, IL. 60008
Date: Mon, 28 Sep 92 15:30:45 GMT

In article <1992Sep25.154501.10007@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU  
(John MAX Skaller) writes:
> 	1) Suppose the Q manager enQs and deQs things, for example,
> it might want to move some items from one queue to another. It uses
> the 'Q' class. I want enQ and deQ to be public members of Q.
> I also want 'getsome(NQ&)' and 'putsome(DQ&)' to restrict the operations.
> 
> 	2) Is protected inheritance actually legal? It is not
> mentioned in the text of CH11 that I can see, yet it is implied
> by the syntax and supported by Borland.
> 
> 	3) In your solution I could NOT call 'getsome(NQ&) because
> upcasting is only allowed to a public base.
> 

Try this:

class EQ
{ public: virtual void enQ();
};

class DQ
{ public: virtual void deQ();
};

class Q: public EQ, public DQ
{
  protected:
    void enQ() {...};
    void deQ() {...};
  public:
    // some queue management functions...
};

Q * q = new Q;
EQ * eq = q;
DE * dq = q;

eq->enQ(); // okay;
dq->deQ(); // okay;
q->enQ();  // error: enQ is not accessible in Q
q->deQ();  // error: deQ is not accessible in Q

David Shang

Newsgroups: comp.lang.c++
From: muenkel@tnt.uni-hannover.de (Heiko Muenkel)
Subject: Looking for a PD- C++- Library
Reply-To: muenkel@tnt.uni-hannover.de
Organization: Universitaet Hannover, Theoretische Nachrichtentechnik
Date: Fri, 2 Oct 1992 08:54:25 GMT

Hi,


I'm looking for a public domain C++ standart library (something like libC.a),
because I'm trying to build a C++-library for a transputersystem. I know the
GNU-library libg++, but I think, that this library must be build with GNU's
C++-compiler and I must use a compiler which translates C++-code to c-code.

Thanks in advance,

Heiko

---
________________________________________________________________________________

Dipl.-Ing. Heiko Muenkel           Universitaet Hannover
				   Institut fuer Theoretische Nachrichtentechnik
				   und Informationsverarbeitung
muenkel@tnt.uni-hannover.de        Appelstrasse 9A
fax:    +49-511-762-5333           D-3000 Hannover 1
phone:  +49-511-762-5323           Germany
________________________________________________________________________________
From: danodom@matt.ksu.ksu.edu (Dan Odom)
Newsgroups: comp.lang.c++
Subject: Re: Windows front-end to Paradox
Date: 2 Oct 1992 19:54:41 -0500
Organization: Kansas State University
NNTP-Posting-Host: matt.ksu.ksu.edu

   I think that I got PX Engine for about $75 on some special offer.
I think that it is about $500 normally (kinda high for a single
floppy).  I could be wrong, as my estimation is based on a comment
from a friend.  No flames, please (flame Borland; they have the high prices).
-- 
Dan Odom
Kansas State University
danodom@matt.ksu.ksu.edu
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.c++
Subject: Re: Persistance Problem Solved by Memory-Mapped Files?
Date: 2 Oct 1992 23:07:27 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <1992Oct1.144640.14630@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>In article <1a9uh5INN4o4@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
>>In article <d8_p1zq.feustel@netcom.com> feustel@netcom.com (David Feustel) writes:
>>.  Pointers between objects have to be replaced with offsets from
>>the base of the file.  
>
>	You're making a hidden assumption here: you're perhaps too familar
>with linear address machines. 

I cut my system programming teeth on Multics, and later moved on to Lisp
Machines.

>			       On the 386 one could map a file to
>a segment. A pointer already consists of a selector for the segment (file)
>and an offset into the segment (file). Such pointers would not have
>to be 'replaced' since they already have the right form. The problem is
>reduced to associating selectors with files consistently.

That may be non-trivial, unless there's some kind of global mapping of
segment selectors to files, so that the selectors have consistent use
across processes.  In a networked environment this could be tricky to
guarantee.

>>Also, memory-mapped files only work if all the cooperating processes share
>>a file system that supports it.  I'm not sure how reliable writing to
>>memory-mapped files is when NFS is in use (I don't think each write to the
>>mapped memory results in an NFS write, so multiple copies of the file could
>>get out of sync).
>
>	Again, on the 386 this is trivia, since the VM system buffers the
>files exposing the same PHYSICAL memory to all processes. 

Not if they're on different machines on the network, which don't share any
physical memory.  If machine1 and machine2 both map a file on serverA,
writes to the memory on machine1 may not be propogated to serverA
immediately, and even if they are, they may not be propogated to machine2
immediately.  As I said, it depends on the file system type and
implementation.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Newsgroups: comp.lang.c++,comp.std.c++
From: pat@frumious.uucp (Patrick Smith)
Subject: Re: Conceptual Constness
Date: Thu, 1 Oct 1992 05:32:36 GMT
Reply-To: uunet.ca!frumious!pat
Organization: None

jbuck@forney.berkeley.edu (Joe Buck) writes:
|I, for one, hope that the ~const proposal is taken seriously.  I'd like
|to go even further, and permit objects with constructors to be in ROM
|in cases where this is possible (it is possible if the initialization
|can be done at compile time and the relevant constructor is inline).

Const objects are treated as non-const inside destructors.

So another necessary condition is that either the object's destructor
is never called or it does not change the object.

-- 
Patrick Smith
uunet.ca!frumious!pat
pat%frumious.uucp@uunet.ca
Newsgroups: comp.lang.c++
From: mat@mole-end.matawan.nj.us
Subject: Re: Access to virtual base classes
Summary: ARM 11.7
Keywords: Access, virtual base classes, ARM
Organization: :
Date: Fri, 25 Sep 1992 19:53:34 GMT

In article <13132@ztivax.UUCP>, stal@ztivax.UUCP (Michael Stal) writes:
 
> Suppose you declare the following classes:
 
> class A {};
 
> class Bpubl : virtual public A {};
> class Bpriv : virtual private A {};
 
> class C : public Bpubl, public Bpriv {};
 
> What happens with the access specifiers in this example?

See ARM section 11.7 .  When a base class can be accessed through
multiple paths (requiring it to be virtual) the least restrictive
access specification is used.
-- 
 (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: satish@sun.mcs.clarkson.edu (Satish Thatte)
Subject: Tutorial on C++
Reply-To: satish@sun.mcs.clarkson.edu
Organization: Clarkson University
Date: Tue, 6 Oct 1992 15:35:58 GMT


I am teaching a class on OOP using C++ and some of my students are having
trouble grasping C++ concepts.  Is there a (free!) "computer aided"
tutorial out there that might be useful for novices?

Please reply to me directly and thanks in advance for all advise/hints/pointers.

Satish
Newsgroups: comp.lang.c++
From: tpenttin@majakka.uku.fi (Tommi Penttinen)
Subject: Windows programming and BC++ 3.0
Date:  1 Oct 92 13:18:09 GMT
Organization: University of Kuopio, Finland

I have just bought Borland C++ 3.0.
I'm wondering how you can make Windows programs with Borland C++ 3.0 when
there is no manual with it discussing Windows programming.. Do I need to
purchase a separate book(s)? Would the book have to be specifically written
for Borland or would any Windows programming book do? Any suggestions?
I remember having heard that buyers of BC++ would receive a book on Windows
programming after sending in their registration card.. Is this true or just
my imagination?

ANy replies appreciated..

+Tommi
-- 
      +---------------------------------------------+-----------------------+
 O o  +   My social-security#: 35^3fd1"q@ (coded;)  +  Tommi Penttinen      +
  _   +   ++(Tomm:)  /* Live long and prosper */    +  tpenttin@cs.uku.fi   +
      +---------------------------------------------+-----------------------+
From: ric@updike.sri.com (Richard Steinberger)
Newsgroups: comp.lang.c++
Subject: Examples of network SW objects?
Date: 5 Oct 92 15:28:31 GMT


	Does anyone have any code/shareware with examples of network
objects.  For example, the parent class might define virtual read, write,
open, close and control member functions.  A BSD-socket child object might
add socket-specific calls.  A message-queue child might add other specific
calls.  Both would define their own read, write, open, close and some others.

	I have some "traditional K&R c" BSD socket and SYSV msg-queue codes
that I would like to upgrade to c++.  It would be nice to introduce
objects at that time.

	Thanks for any ideas/suggestions.  

regards,

	ric steinberger
	ric@updike.sri.com

PS - I am working on SUNS (4.1.2, eventually Solaris 2.x) with SUN's C++,
but also have gcc available.
Newsgroups: comp.lang.c++
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: Problem with overloaded * operator
Organization: Computer Science, University of Melbourne, Australia
Date: Fri, 2 Oct 1992 05:38:10 GMT

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.
>
>I expected that using the overloaded operator *a would return the character
>pointer theString.  In fact it appears to return the character 'T' (i.e.
>the thing pointed to by theString).

The problem is that instead of overloading the "*" operator, you overloaded
the (const char *) conversion operator.

>A second question I have is about the use of the const keyword in the
>declaration of the overloaded operator.  It is defined as
>
>    operator const char *() const;
>
>I am not clear what the effect of the second const is.  Is this equivalent
>to "const char const *"??

No, the second const qualifies (*this). It means that this particular
member function does not modify the object it is invoked on.

See The C++ Programming Language 2nd Ed page 148 (or look up
"constant member functions" in any good C++ book).

>======================================================================
>
>#include <iostream.h>
>#include <string.h>
>#include <stdlib.h>
>
>class String {
>
>public:
>
>    String( const char *text = "" );
>    ~String();

You should also provide a copy constructor and an assignment operator,
since the default compiler-generated ones will not do what you want here.

>    operator const char *() const;
>
>private:
>    char *theString;
>    };
>
>
>String::String( const char *text ) {
>    theString = new char[strlen(text)];

That should be strlen(text) + 1, because you need one extra for the
terminating '\0' character.

>    strcpy( theString, text );
>    }
>
>String::~String(){
>    delete theString;
>    }
>
>
>String::operator const char *() const {
>    return theString;
>    }

This defines a conversion operator from String to (const char *).

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

Here the conversion operator is automatically invoked, so that *a
becomes equivalent to *(const char *)a, which in turn is equivalent to
*(operator const char *(a)). Thus operator const char *(a) returns a.theString,
and so *a is equivalent to *(a.theString).

>    return 0;
>    }

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
Newsgroups: comp.lang.c++
From: mittle@siena.watson.ibm.com (Josh Mittleman)
Subject: Re: static reference
Date: Tue, 06 Oct 92 17:08:08 GMT
Organization: IBM T. J. Watson Research


> class a {
> 	static a *sap;
> 	static a &sar;
> public:
> //	a () { if (sar == 0) init_stuff };
> };
> 
> a *a::sap;
> a &a::sar;  
> 
> MC cl complains about 'sar' having to refere to something. Fine I want it
> initialize to zero. 

You can't.  The fundamental difference between a pointer and a reference is
that a reference has a fixed value: it MUST be initialized and cannot be
re-assigned or deleted.  A pointer can be null and can be re-assigned.  

===========================================================================
Josh Mittleman (mittle@watson.ibm.com)
J2-C28 T.J. Watson Research Center, PO Box 704, Yorktown Heights, NY  10598
Newsgroups: comp.lang.c++
From: frank@Cookie.secapl.com (Frank Adams)
Subject: Re: declare keyword, type inference
Date: Mon, 05 Oct 1992 23:27:31 GMT
Organization: Security APL, Inc.

In article <23797@alice.att.com> ark@alice.UUCP () writes:
>In article <TMB.92Oct4201915@arolla.idiap.ch> tmb@idiap.ch writes:
>> 	template <class T> typedef Array<Array<T> > Foo;
>
>Does this buy anything over
>
>	template <class T> class Foo: public Array<Array<T> > { }
>
As noted, the difference is that the second creates a new class.  This makes
a significant difference if you want to have other classes inherit from the
original class.  For example:

   template <class EltT, class KeyT> class Map;
   template <class EltT> typedef Map<EltT, char> CharMap;
   template <class EltT, class KeyT> class HashDictionary : Map<EltT, KeyT>

(The assumption here is that Map is abstract, while HashDictionary is
concrete.)  We would like for HashDictionary<Foo, char> to be a subclass of
CharMap<Foo, char>; with the class definition, it is not.
Newsgroups: comp.lang.c++
From: head@dorsai.com (Howard Pinsley)
Subject: BC++ Class Browsing
Organization: The Dorsai Embassy +1.718.729.5018
X-Newsreader: Tin 1.1 PL4
Date: Fri, 25 Sep 1992 19:21:53 GMT

I'm having some trouble getting the borland windows IDE class browser
to function correctly.  It seems that for a project I'm building the browser
functions properly for some classes and not others.  Specifically, I want to
take advantage of the "jump to source" feature after the browser has 
highlighted a member function.  In some instances it correctly jumps to
the definition of the member function.  In others, it jumps to the top
of the class declaration.  

In addition, it sometimes puts up a message box saying "No declaration
information" or something to that affect.  I have checked the "Include browse
info" box in the advanced compilation options.

Has anyone else had this problem or can anyone shed some light?  Thanks. 

Newsgroups: comp.lang.c++
From: srinivas@lgc.com (Manapragada Srinivas)
Subject: Forward declaration of classes
Followup-To: comp.std.c++
Organization: Landmark Graphics LGC
Date: Thu, 1 Oct 1992 21:48:25 GMT

Is the following forward declaration valid?

		class foo : public bar;

Where I am trying to declare that foo is a class which is publicly derived from 
bar. It works like a charm in g++ 2.2.2, whereas SUN CC2.1 results in a syntax
error. Which behaviour conforms to the standard? The ARM is silent on this
issue. When I followed the grammar in the appendix the above type of syntax did
not seem to be valid.

I would apreciate it very much if someone could shed some light on the above.

Thanks,
Srinivas
-- 
Yonder, beyond the event horizon!
Xref: sparky comp.lang.c++:14626 comp.std.c++:1332
From: osoelgaultier+@CMU.EDU (Stefan Monnier)
Newsgroups: comp.lang.c++,comp.std.c++
Subject: Re: The concept of templates considered ill designed
Date: 6 Oct 92 23:25:36 GMT
	<1992Oct6.174129.10404@genghis.borland.com>
Organization: Junior, Math/Computer Science, Carnegie Mellon, Pittsburgh, PA

Excerpts from netnews.comp.lang.c++: 6-Oct-92 Re: The concept of
template.. Pete Becker@genghis.borl (1483)
> 	I seem to have not made myself clear.  What I was responding to was
> the claim that constrained parameters ALLOW THE TEMPLATE DEFINITION TO BE
> COMPILED INDEPENDENTLY OF ANY PARTICULAR INSTANTIATION.  While that's
> certainly true, it offers very little beyond what's currently available
> without using templates, precisely because the compiler knows nothing about
> the actual types of the template parameters.
> 	If you want constrained templates AND independent compilation of
> template definitions, you've already got it.  But don't call it a template.
> Call it a forwarding class.
> 	-- Pete


The point with templates in general, IMHO (but I believe it's shared
by others), is to to be able to typecheck. Else, a pointer to void with
some casts could do the trick.

template <class T> T hello(T t)

is not the same as

T hello(T t)

cause if you call hello with a type Hi (which inherit from T), you know 
that it will return an object of type Hi, whereas without templates, 
this is not checked: It can return any object of type T (maybe it is also of 
type Hi, but no typechecking occurs here: you're only responsible for it)

Constraints templates doesn't change anything to this fact. The only
thing it changes is that the internals of a function (or anything else)
depending on a template (like hello) can be checked (and compiled)
before using it: separately !

If it has some speed drawbacks (cause it is harder to fully optimize
(although possible)), I don't really care: the difference may not be that big
(and if you really care about top-speed, use plain C or assembler or avoid
templates and typecheck yourself)

	Stefan

-----------------------------------------------------
-- On the average, people seem to be acting normal --
-----------------------------------------------------
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.c++
Subject: Re: Shallow & Deep copies of objects
Date: 6 Oct 1992 20:34:22 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <92280.110023U45561@uicvm.uic.edu> Dimitrios K. Valsamis <U45561@uicvm.uic.edu> writes:
>Could anyone explain to me what is a Shallow and a Deep copy of an object? How
>easy is to implement functions for perfoming those operations on ANY kind of
>object?

Shallow and deep copying come into play when you have an object that
contains pointers to other objects in it.  In a shallow copy, the copied
object contains pointers to the same objects that the original object
pointed to.  In a deep copy, you recursively copy these other objects as
well (and any objects they have pointers to, etc.).

>One more question that I am have is dealing with the new and delete operators.
>When do we usually overload those operators?

When you want to control they way that storage is allocated for objects.
For instance, if an object has to have a certain address (e.g. it's a
memory-mapped I/O port), or you want to do your own memory management
instead of using the regular heap.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Newsgroups: comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: Good book on C++
Organization: TauMetric Corporation
Date: Wed, 30 Sep 1992 17:01:12 GMT

pete@cssc-syd.tansu.com.au (Peter Alexander Merel) writes:

>berrios@aps.anl.gov (Joe Berrios) writes:

>>In article 717721582@mont, stephen@mont.cs.missouri.edu (Stephen Montgomery-Smith) writes:
>>>What is the `definitive' C++ book?  Or at least, is there a complete
>>>book on C++ that is fast paced, something like K&R on C.

>>The `definitive' C++ book is: the C++ programming language, 2nd edition, by
>>Bjarne Stroustrup, the author is the designer and implementor of C++.

>No. The standard reference (and ANSI base document) is the ARM, as discussed
>in the FAQ. The full poop is:

>`Annotated C++ Reference Manual', Ellis and Stroustrup, Addison/Wesley
>ISBN 0-201-51459-1

The books serve different purposes.  The "ARM" is the complete language
definition (the "reference manual") interspersed with commentary
("annotations") explaining reasons for language rules and possible
implementations of features.  This is the place to look up fine points
of language definition.  This is not the book to use for learning C++.

"The C++ Programming Language" is a language tutorial, quite complete,
and includes the reference portion (without annotations) of the ARM
as an appendix.  If you want a book "like K&R on C", this is the one.
Be sure to get the 2nd edition, not the one from 1986.  (The publisher
is Addison-Wesley.)

A minor comment:  Stroustrup was the designer and first implementor of
C++, but is by no means the only one now.  A number of companies,
including my own, produce C++ implementations not based on Stroustrup's.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Newsgroups: comp.lang.c++