HDTenEightyP/NetNews huggingface dataset:
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Tagged Pointers
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Tue, 18 Aug 1992 01:33:57 GMT

In article <1992Aug17.174931.1376@fcom.cc.utah.edu> swillden@news.ccutah.edu (Shawn Willden) writes:
>maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>
>: 	It all depends on whether tagged pointers are a genuine
>: type or not. If it is, all the above things must be distinct.
>: If not (I suggested not in my post) then maybe we can make
>: a pointer to a tagged union work as if it were a tagged
>: pointer. This would homogenise the interface. More work
>: for the compiler, less for the programmmer. Less control
>: for the programmer too.
>
>Hmmm.  It appears I didn't explain myself very well because that is
>precisely what *I* was suggesting.  I suppose the difference lies in
>my consideration of TP's and TU's as different types but (as I said)
>
>	1)	*TP yields a TU
>	2)	&TU yields a TP
>
>whereas you suggested that they not be actual *types* but that we 
>make them work like the above anyway.  Same effect, different words.
>Have I got this right?

	I'll have to think on this carefully, everytime I try
to reply I get confused :-)

>
>: 	So the issue is whether a tagged pointer is a proper type
>: or just a sort of syntactic sugaring that supports a new 
>: mechanism for genericity. My thinking was the latter.
>
>I think your thinking is better :-)  TP couldn't be a proper type
>anyway.  If anything, TP would be a *family* of types.
> 
>: 	Any comments?
>
>Getting back to the question that started this exchange (should we have
>tagged references?), I think that they're probably unnecessary for the
>case I was presenting (by which I mean that they don't greatly simplify 
>anything).  If I have a TP and wish to pass a reference to what it points 
>to to a function I can just say:
>
>void foo([T1,T2,T3]& fred)	// fred is a ref to a TU, not a tagged ref.
>	{...}
>
>void bar();
>	{
>	[T1,T2,T3]* barney;
>	...
>	foo(*barney);		// *barney is a TU, foo gets a ref to it.
>	}
>
>at least that is what the programmer may think.  In fact TU and TP are not
>types but the syntax of the sugar looks right.  Actually, does it really 
>matter whether we call [T1,T2,T3]& a ref to a tagged union or a tagged 
>ref?
>

	Yes. The compiler has to know where to find the tag,
next to the pointer, or where the pointer is pointing.
The rule has to be next to the pointer. So taking the address
or making a reference to a tagged union has to copy the tag.

	To work out the exact rules I think in terms of the implementation.
I'll have a go soon, perhaps while on holidays. 

-- 
;----------------------------------------------------------------------
        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: jkokko@lesti.hut.fi (Jari Kokko)
Subject: Borland C++ 3.0: Using ifstream
Summary: Novice Alert!
Keywords: Problem with 'const unsigned char far*'
Reply-To: jkokko@lesti.hut.fi (Jari Kokko)
Organization: Helsinki University of Technology
Date: Wed, 12 Aug 1992 17:09:57 GMT

I'm fairly new to C++, so bear with me.
I'm sure this is a problem with some silly option:

Here is the code (part) that I've been working on for app. 30 hours ;<
(I'm trying to open a file and output it to stdout).
#include <iostream.h>
#include <fstream.h>

main() {
  ifstream inFile;
  inFile.open("file.txt");
  // Linker Error:
  // Undef'd symbol fstreambase::open(const unsigned char far*,int,int)
  // in module HUU.CPP
  // Memory model Large, Source Ansi C++
  cout << inFile;
  inFile.close();
  return 0;
}

So, what is going on in here !

I've resorted to editing <fstream.h> because of the _FAR and _Cdecl
things in there. Taking out _FAR or replacing it with far won't help,
replace it with near I haven't tried !

I've been running Borland C++ 3.0 under OS/2 2.0 and under DOS with
most memory models. I see in _defs.h file that when __OS2__ is def'd
_FAR is empty.

Any help is welcome, reply by email, I'll post the answers I get when
I get this to work.
-- 
//jkokko // Email: Jari.Kokko@hut.fi \\ (358)(0) 8794431 \\
------------------------------------------------------------
Newsgroups: comp.lang.c++
From: ohrd!twriter@cs.toronto.edu (Timothy Writer)
Subject: Re: Help: Looking for documentation on iostream library.
Keywords: iostream
Organization: "Ontario Hydro - Research Division"
Date: Wed, 19 Aug 92 15:09:55 GMT

jss@lucid.com (Jerry Schwarz) writes:

>In article <1992Aug18.034448.18472@ohrd.uucp>, ohrd!twriter@cs.toronto.edu (Timothy Writer) writes:
>|> I recently compiled gcc-2.2.2 and libg++-2.2 for my workstation,
>|> replacing g++-1.40.3 and libg++-1.39.0.  I understand that the
>|> (io)stream library has changed substantially to conform to the proposed
>|> ANSI standard.  Unfortunately the documentation for libg++-2.2 assumes
>|> the user has adequate documentation for iostreams.  As I have already
>|> spent a small fortune on C++ books which predate the (new) iostream
>|> library, I am reluctant to purchase another.  Is there a
>|> book/paper/report which fully documents only the iostream library?
>|> Where can I get one?  Is there anything available via anonymous ftp?


>The g++ iostream library is based primarily on the AT&T iostream
>library, that shipped with cfront 2.0.  It should be discussed in

Thanks for the correction.

>any text for that level of the language.  It is described briefly
>in Lippman "C++ Primer 2nd Edition" and Stroustrup "C++ Programming
>language 2nd edition".  More extensive documentation including man

I have the *first* edition of both Lippman and Stroustrup.  If these
were the only C++ texts I have, I would be happy to buy the second
editions as they are now somewhat dated.  However, I also have the ARM,
"Advanced C++" by Coplien, and "The C++ Answer Book" by Hansen.  I am
reluctant to invest in the *second* edition of either Lippman or
Stroustrup simply for their brief discussion of the iostream library.

>pages and a paper entitled "Iostream Examples" (by myself) is shipped
>with most cfront ports. As far as I know there are no ftpable documents.

Short of buying cfront, is there any *complete* reference for the
iostream library?  I am happy to spend money if my purchase gives me
what I need.

>   -- Jerry Schwarz

Tim 

-- 
Tim Writer			     phone:  (416) 231-4111 ext. 6990
Ontario Hydro Research Division	     fax:    (416) 237-9285
Toronto, Ontario		     e-mail: cs.toronto.edu!ohrd!twriter
CANADA					     cs.utoronto.ca!ohrd!twriter
Newsgroups: comp.lang.c++
From: jonas@beppe.ericsson.se (Jonas Nygren)
Subject: Re: Garbage Collection for C++
Reply-To: jonas@beppe.ericsson.se
Organization: Ericsson Telecom AB
Date: Thu, 20 Aug 1992 13:45:54 GMT

In article 92Aug20023846@synaptx.synaptics.com, daveg@synaptics.com (Dave Gillespie) writes:
> In article <TMB.92Aug18123919@arolla.idiap.ch> tmb@arolla.idiap.ch (Thomas M. Breuel) writes:
> 
> > I hope we can agree that GC costs you nothing if it doesn't run
> > (malloc and free in the presence of GC don't look very different from
> > the way they do now).
> 
> Well, as long as you don't introduce tagged pointers, maintain a
> linked list of all GC pointers, or anything like that.  (And I think
> most of us would agree that you'd want to avoid all those things if
> you possibly can, and it looks like you can pretty easily.)

How do you handle C++ arrays without any extra book-keeping? Can arrays be
handled by GC without extra book keeping?

> 
> 								-- Dave
> --
> Dave Gillespie
>   daveg@synaptics.com, uunet!synaptx!daveg
>   or: daveg@csvax.cs.caltech.edu

/jonas



Newsgroups: comp.lang.c++
From: pjl@sparc6.cs.uiuc.edu (Paul Lucas)
Subject: Re: Return value for the constructors.
Organization: University of Illinois at Urbana-Champaign
Distribution: usa
Date: Wed, 19 Aug 1992 01:19:03 GMT

In <3468@unisql.UUCP> nandraj@unisql.UUCP (Nandraj Arni) writes:

>> In article <3462@unisql.UUCP>, nandraj@unisql.UUCP (Nandraj Arni) writes
>> :
>> >
>> >    Why does C++ not let you have a return value for a constructor?
>> > Is there any rationale behind this?
>> 
>> Before we answer that question, we should ask what do you want it for?
>> A language can't provide every conceivable feature; unless a feature is a
>> significant improvement to the language, it is an unnecessary complicati
>> on.

>  The reason I think it is a important feature the constructor should
>return whether it was a success or not? Say I want there is a time
>class which takes in put as MM/DD/YY. If the values were out of range
>for an instance of this class, the user should know that it was a bad
>way to construct this class. OR say it could not allocate memory...

*****>	You should have said that originally.  *THAT* purpose is one of
	the things that the forthcoming excpetion-handling feature will
	address.
-- 
	- Paul J. Lucas				University of Illinois	
	  AT&T Bell Laboratories		at Urbana-Champaign
	  Naperville, IL			pjl@cs.uiuc.edu
From: brister@decwrl.dec.com (James Brister)
Newsgroups: comp.lang.c++
Subject: Re: Reference counting for vectors, (Tony Hansen's book).
Date: 14 Aug 92 18:07:06 GMT
Article-I.D.: tirade.BRISTER.92Aug14110706
Organization: DEC Western Software Lab

On Fri, 14 Aug 1992 16:47:19 GMT, abed@venus.wustl.edu (Abed M. Hammoud) said:
> I was trying to implement the vector class using the method suggested
> by tony Hansen. i.e reference counting. the following code is taken
> from Hansen's book (C++ Answer book). There is some thing that doesn't
> seems correct.

What's not correct? The fact that modifying one variable causes the other
to change? If that's not what you want, then this isn't for you, but in the
case where you're making multiple copies of the array (as paramaters to a
function, for example), then this scheme is great.

I do remember seeing an article in a magazine a while back about COW (copy
on write), where the new array (i.e. 'B' here)

> 	vector B = A; 

would release the referrence and make a duplicate of the real data if any
data was going to be modified. Unfortuantely I can't remember the details
right now of how it worked, but it didn't seem too tough to do.

(If anyone can refresh my memory that would be good.)

James
--
James Brister                                           brister@wsl.pa.dec.com
DEC Western Software Lab., Palo Alto, CA                        decwrl!brister
Newsgroups: comp.lang.c++
Subject: Re: Garbage Collection for C++
From: Bruce.Hoult@bbs.actrix.gen.nz
Date: Tue, 18 Aug 1992 04:55:33 GMT
Organization: Actrix Information Exchange

In article <TMB.92Aug17204854@arolla.idiap.ch> tmb@idiap.ch writes:
> 
> Incidentally, there is a widely used, simple, efficient, more general,
> and completely portable technique for getting the same kinds of
> storage savings as with the XOR trick.

Well you can trivially subtract the pointers instead of XORing them.
That would be more portable in practise, although I don't think ANSI C
guarentees that you can subtract arbitrary pointers. but only ones to
elements of the same array or struct.
-- 
Bruce.Hoult@bbs.actrix.gen.nz   Twisted pair: +64 4 477 2116
BIX: brucehoult                 Last Resort:  PO Box 4145 Wellington, NZ
"Cray's producing a 500 MIPS personal computer with 256MB RAM and 8 GB
hard disk that fits in your pocket!"   "Great!  Is it PC compatible?"
Newsgroups: comp.lang.c++
From: jss@lucid.com (Jerry Schwarz)
Subject: Re: Help: Looking for documentation on iostream library.
Keywords: iostream
Reply-To: jss@lucid.com (Jerry Schwarz)
Organization: Lucid, Inc.
Date: Tue, 18 Aug 92 19:29:01 GMT

In article <1992Aug18.034448.18472@ohrd.uucp>, ohrd!twriter@cs.toronto.edu (Timothy Writer) writes:
|> I recently compiled gcc-2.2.2 and libg++-2.2 for my workstation,
|> replacing g++-1.40.3 and libg++-1.39.0.  I understand that the
|> (io)stream library has changed substantially to conform to the proposed
|> ANSI standard.  Unfortunately the documentation for libg++-2.2 assumes
|> the user has adequate documentation for iostreams.  As I have already
|> spent a small fortune on C++ books which predate the (new) iostream
|> library, I am reluctant to purchase another.  Is there a
|> book/paper/report which fully documents only the iostream library?
|> Where can I get one?  Is there anything available via anonymous ftp?


The g++ iostream library is based primarily on the AT&T iostream
library, that shipped with cfront 2.0.  It should be discussed in
any text for that level of the language.  It is described briefly
in Lippman "C++ Primer 2nd Edition" and Stroustrup "C++ Programming
language 2nd edition".  More extensive documentation including man
pages and a paper entitled "Iostream Examples" (by myself) is shipped
with most cfront ports. As far as I know there are no ftpable documents.

   -- Jerry Schwarz



Newsgroups: comp.lang.c++
From: rcox@cad625.intel.edu (Richard Cox)
Subject: C++ standards / CASE
Keywords: C++, Software, Methodology, standards
Reply-To: rcox@scdt.intel.com
Organization: Intel Corporation
Date: Thu, 20 Aug 1992 19:06:16 GMT

Hi Does anyone know of a good set of coding standards for C++?  Also are there
and good CASE tools for software development?  I know CASE is very general so
a description would be most helpful.

-Rich

-- 
+-----------------------------------------------------------------------------+
|Rich Cox      	       	       	       	   E-Mail: rcox@scdt.intel.com 	      |
|CAD Developer                             AOL: Rich Kid                      |
|Intel Corp.  				   Mailstop: SC3-39     	      |
|      	       	        		   Phone: (408) 765-5199              |
|-----------------------------------------------------------------------------+
| These opinions are shared by everyone, I asked them...                      |
+-----------------------------------------------------------------------------+
Newsgroups: comp.lang.c++
From: hf@informatik.uni-kl.de (Harald Fuchs)
Subject: Re: Garbage Collection for C++
Organization: Kaiserslautern University, Germany
Date: Fri, 14 Aug 1992 11:32:52 GMT

> For reference, here's KCL's solution (roughly):  Memory
> is divided into pages.  All objects stored on a given page will
> have the same size.  There is a "page table" which contains, for
> each page of memory, the size of the objects stored in that page
> (or zero for pages which do not contain GC-able things).  Given
> any 32-bit quantity which "might" be a pointer, first take the
> high bits to find the page, check if this is a valid GC-able page,
> and if so, round the page offset down to a multiple of the page's
> object size to get a pointer to an object on the page.

This works fine for Lisp systems where you have only a limited number
of basic object types and thus a limited number of possible sizes. I
don't think that it would work for C++ where the application
programmer can create lots of objects with different sizes.
But you can use this scheme if you want to GC only some of your objects.
--

Harald Fuchs <hf@informatik.uni-kl.de>
Newsgroups: comp.lang.c++
From: prem@phd.lbl.gov (Shirdi R. Prem)
Subject: Re: SQL and C++
Keywords: Oracle Call Interfaces (OCI)
Reply-To: prem@phd.lbl.gov (Shirdi R. Prem)
Organization: Lawrence Berkeley Laboratory
Date: Wed, 12 Aug 92 19:12:18 GMT


		Hi there,

		Having done some work as a consultant at IBM until last
		week, I may be able to help out a little here.

		Oracle provides something called Oracle Call Interfaces (OCI),
		which allow you to set up your program variables and bind
		them to placeholders in the SQL command.

		What we did was write a class in C++, which opened a login
		session (cursor) to Oracle. Then, we would begin the
		laborious process of setting up the arrays for input variables,
		output vars, indicators and return codes etc. Finally, once
		everything was ready, we would call the Oracle functions
		with these vars.

		It is not much fun to do, but then, it does the job. Since
		this was done in IBM, I am not sure if I can get very generous
		about the specifics without risking some "proprietary code" b.s.

		Another reason is that I am currently "at lunch" and I value
		the half-hour break highly. So, I will keep this short.

		If you have any questions, contact me via e-mail and we will 
		take it from there.

			Good luck,

			Prem!
================================================================================
====	The above is not LBL's opinion. LBL and IBM are trademarks of       ====
====	someone else's. Hey, I'm just trying to help!                       ====
================================================================================
====	prem@csr.lbl.gov    ====    Temporary phone number : 510-745-7220   ====
================================================================================
Newsgroups: comp.lang.c++
Subject: Help : Graphics Formats
From: ebolog@elaine.ee.und.ac.za (EDWIN BOLOGNA : THIRD)
Date: 20 Aug 92 13:06:46 +0200
Organization: Electronic Eng., Univ. Natal, Durban, South Africa


Does anyone out there happen to have PAS, C, or ASM source code to decode
.GIF, .PCX, .FLI, .GL, etc. graphic formats.

Any information at all on any of these formats will be greatly appreciated.

        Desperate fellow programmer (And very Greatful for any information)

                E.B. (EBOLOG@ELAINE.EE.UND.AC.ZA)

PS : Please be kind hearted and Assist !
Newsgroups: comp.lang.c++
From: jss@lucid.com (Jerry Schwarz)
Subject: Re: Binary Stream IO
Reply-To: jss@lucid.com (Jerry Schwarz)
Organization: Lucid, Inc.
Date: Mon, 17 Aug 92 23:03:57 GMT

|> Is there a way to do Binary i/o with the stream classes?  In other words, can I
|> do "oFile << double_value" in such a way that double_value is stored using its
|> binary representation rather than as an ascii string?


You can't use an inserter(<<) operator but you can do

	oFile.write(double_value,sizeof(double_value))

  -- Jerry Schwarz
Newsgroups: comp.lang.c++
From: jss@lucid.com (Jerry Schwarz)
Subject: Re: strstream question
Reply-To: jss@lucid.com (Jerry Schwarz)
Organization: Lucid, Inc.
Date: Tue, 18 Aug 92 21:18:41 GMT

In article <1992Aug18.142928.14515@walter.bellcore.com>, vidal@bae.bellcore.com (Vidal Graupera) writes:
|> I want to change the string in an existing strstream. 
|> This is what I tried on a Sun using their 2.1 compiler:
|> 
|>   char p[100];
|>   ostrstream tstream(p, 100);
|> 
|>   // do some stuff with tstream
|> 
|>   char t[100];
|>   tstream.rdbuf()->setbuf(t,100);
|> 
|>   // tstream still uses p NOT t
|> 

Can't be done.  Setbuf is effective on strstreams only 
if you've used the default constructor and you haven't
inserted anything into the strstream.   If you check the
return from setbuf you'll see it was NULL.  

   -- Jerry Schwarz
From: mehr@fluke.tc.fluke.com (Manooch Mehr)
Newsgroups: comp.lang.c++
Subject: Vitual functions and virtual tables
Date: 12 Aug 92 22:40:51 GMT
Distribution: usa
Organization: John Fluke Mfg. Co., Inc., Everett, WA



   Hi There:

      I have implemented and used virtual functions many times.
      But I would like to know the details of virtual table and how the compiler
      uses the table to invoke the proper virtual function. Please send me an email
      on this subject.

								Thanks,
								Manooch
From: rmartin@dirac.Rational.COM (Bob Martin)
Newsgroups: comp.lang.c++
Subject: Re: OOD and Inheritance question
Date: 21 Aug 92 22:35:48 GMT

hwrvo@kato.lahabra.chevron.com (W.R. Volz) writes:

|I have a question on how to design a set of classes. It probably has a really
|simple answer. But here goes anyway:

|Let's say I have a class called Card (A playing card).
|A collection of Cards is a CardPile. So this implies maybe a linked list.

|Question 1: How should CardPile have the link installed: inherited or member
|data? A link is not a Card so maybe it should be a data member. On the other
|hand, I can create a new entity of CardPile by inheriting from both
|Card and Link. (similar to inheriting from class Boy and class Scout to
|make a new class BoyScout.) What would be best or does it depend a lot of 
|how I'm going to use CardPile? 

You are diving much too quickly into the details of your
implementation.  First, design your application, then fiddle with the
details of how items get placed into linked lists.

The real abstractions here are Card and Pile.  A Card represents a
single playing card.  It has state: (suit and rank).  It's behavior is
unknown to me, but depends upon your application.  For example, for a
poker application, a card will probably need to compare itself with
another card according to the ranking rules of poker.  

Piles are groups of cards.  They have state (some number of cards) and
they also have behavior (shuffle, draw from top, draw from bottom,
draw random, cut, etc....)

There are no inheritance relationships between these classes.  

As to "how the link should be installed"; Card should not have to know
this.  In fact, card should know nothing about Pile at all.  It is up
to Pile to figure out how to manage its list of Card objects.  This
can be done by creating a carrier object which maintains your link,
and also refers to a particular Card.  Pile creates carriers as Cards
are added to the list. 

However, I doubt that you should make Pile manage the list directly.
You probably want to create a List class template, and then have Pile
contain a  List < Card >; member variable....  This helps to decouple
the Pile from the kind of list being used so keep the Cards....



--
Robert Martin                        Training courses offered in:
R. C. M. Consulting                       Object Oriented Analysis
2080 Cranbrook Rd.                        Object Oriented Design
Green Oaks, Il 60048 (708) 918-1004       C++
From: matt@physics16.berkeley.edu (Matt Austern)
Newsgroups: comp.lang.c++
Subject: Re: destruction of temporaries
Date: 19 Aug 92 17:02:29
Organization: Lawrence Berkeley Laboratory (Theoretical Physics Group)
	<23466@alice.att.com> <3920@starlab.UUCP> <23487@alice.att.com>
Reply-To: matt@physics.berkeley.edu
NNTP-Posting-Host: physics16.berkeley.edu
In-reply-to: ark@alice.att.com's message of 19 Aug 92 18:22:44 GMT

In article <23487@alice.att.com> ark@alice.att.com (Andrew Koenig) writes:

[Very clear explanation of the problems with destruction at end of
 block omitted]

> Destruction at end of block is far from a hopeless approach, but I
> think it loses on balance.  Indeed, there's something to be said for
> almost every approach, which is why this is a knotty problem.

I have to say: the more discussion I see on this issue, the better
garbage collection is beginning to sound.  These are exactly the
problems that garbage collection resolves

Unfortunately, it really isn't at all clear to me that garbage
collection and C++ can be made to go together very well.  Naively, it
seems to me that high-quality garbage collection would be a bigger
change to the language than high-quality exception handling.

--
Matthew Austern              I dreamt I was being followed by a roving band 
(510) 644-2618               of young Republicans, all wearing the same suit,
matt@physics.berkeley.edu    taunting me and shouting, "Politically correct
austern@theorm.lbl.gov       multiculturist scum!"... They were going to make
austern@lbl.bitnet	     me kiss Jesse Helms's picture when I woke up.