HDTenEightyP/NetNews huggingface dataset:
From: soundar@cis.ohio-state.edu (m soundararajan)
Subject: libraries for ADTs
Originator: soundar@cerebellum.cis.ohio-state.edu
Keywords: ftp sites, libraries, ADTs
Organization: The Ohio State University, Department of Computer and Information Science
Date: Wed, 8 Apr 1992 20:32:11 GMT

	I am a novice in c++ programming. I have to do a project in c++. For 
this I need data structures like linked lists, doubly-linked lists, arrays &
 maybe more. I would like to know if these are available at some ftp sites 
with the operations such as delete, insert etc. to be performed on them 
already. 

	I would also like to know of how one goes about from thinking 
(programming) procedurally to programming in OOP. This is what c++ is all 
about. Any information in this regard is highly appreciated.

- Madhu Soundararajan     	 email: soundar@cis.ohio-state.edu
From: pete@borland.com (Pete Becker)
Newsgroups: comp.lang.c++
Subject: Re: Borland's design decisions
Date: 15 Apr 92 23:52:27 GMT
Article-I.D.: borland.1992Apr15.235227.27218
Organization: Borland International

In article <3437@daily-planet.concordia.ca> strider@concour.cs.concordia.ca (GEORGAKAKIS peter) writes:
>
>Unordered collections do not iterate very well.  The minimum behaviour of an
>iterator should be that it can traverse a collection from beginning to end 
>passing every element of the collection on the way only once.  No
>insertions/removals are done.  With unordered collections the path
>taken for this traversal cannot be guaranteed.  When an
>insertion/removal is performed on an unordered collection the
>iterators iterating that collection can not have a specified behaviour
>since the collection itself does not have a specific ordering
>property.  
>

	On the contrary, unordered collections iterate quite well.  It's the
combination of iteration with simultaneous modification of the collection that
doesn't work well.  Which is the basic reason I don't think the combination
makes sense.
	-- Pete
From: werner@spss.com (John Werner)
Newsgroups: comp.lang.c++
Subject: Re: overloading [] for bitvectors?
Date: 13 Apr 92 17:29:23 GMT
Organization: SPSS Inc.

In article <Garym.0bo0@qube.OCUnix.On.Ca> Garym@qube.OCUnix.On.Ca (Garym) writes:
>I have a bit-array class
>to store large lists of bit values in a compact form, and in a nutshell
>what I would like are statements like the following:
>
>     bitvector[17] = TRUE;
>     if (bitvector[3]) do_something();

This question has come up a lot lately, and the best solution seems to
be a bitvector::operator[] that returns a new object (call it
"bitref") that contains the index and a reference to the bitvector.
Then bitref can define a cast operator (operator int or whatever) to
use when an rvalue is needed, and an assignment operator (bitref &
operator=(int)) to use when an lvalue is needed.

There is a good discussion of this issue in section 3.3 of "Advanced
C++ Programming Styles and Idioms", by James Coplien, Addison-Wesley,
1992.

--
-------------------------------------------------------------------------
John Werner   |    werner@spss.com    |    If these were SPSS's opinions,
SPSS, Inc.    |    (312) 329-3677     |    I wouldn't be posting them.
From: warwick@cs.uq.oz.au (Warwick Allison)
Newsgroups: comp.lang.c++
Subject: Re: A coding style question
Date: 16 Apr 92 01:12:44 GMT
Reply-To: warwick@cs.uq.oz.au

skip@taygeta.oc.nps.navy.mil (Skip Carter) writes:


>        class BlueFile
>        {
>              private:
>                    void EBCDIC_to_ASCII(char *, int);
>                    void ASCII_to_EBCDIC(char *, int);
>              public:
>                    BlueFile(char* name, int mode);   // open an EBCDIC file
>                    ~BlueFile();                      // close it
>                    int read(char*, int);             // read from it
>                    int write(char*, int);            // write to it
>        };


>   The question is:

>   If the functions EBCDIC_to_ASCII and ASCII_to_EBCDIC
>   get pass all data in/out by the parameter list should they be made
>   private members of the class or  should they be removed from the
>   class specification and be made ordinary static functions ?                


If a routine can be used outside your class, then let it be.  The conversion
functions should have nothing to do with your class - it just uses them.  Put
them in their own source file, make them robust, and provide a header file.

Well, that's what I would do.


>   What are the pros and cons of these two designs ?

Code reuse.  Someone else might want to write "BlueString" that's like your
class, except deals with strings.  Now consider what would happen if these
two classes had inconsistent (i'e one or more buggy) implementations of
you *_to_* routines, but where used together...


--
Warwick
--
  _-_|\      warwick@cs.uq.oz.au            / eastings genistas /
 /     * <-- Computer Science Department,  / giantess seatings /
 \_.-._/     University of Queensland,    / teasings tsiganes /
      v      Brisbane, Australia.        / -------- -------- /
From: liu@matt.ksu.ksu.edu (Zu-Huan Liu)
Newsgroups: comp.lang.c++
Subject: Borland C++ 3.0 for sale
Date: 13 Apr 1992 16:01:07 -0500
Organization: Kansas State University
Distribution: world
NNTP-Posting-Host: matt.ksu.ksu.edu

The whole package. Still Not Opened yet. Only one copy.
Only $100.00 (include shipping UPS Ground in USA) or best offer.
If you are interested of the package , please contract with me.
My address liu@matt.ksu.ksu.edu or liu@ksuvm.ksu.ksu.edu
From: nadeau@JSP.UMontreal.CA (Nadeau Jean-Claude)
Newsgroups: comp.lang.c++
Subject: Re: Surprise!! A bug in C for ANY compilor.
Date: 10 Apr 92 14:54:30 GMT
Distribution: usa
Organization: Universite de Montreal

In article <34909@uflorida.cis.ufl.EDU> zzang@pine.circa.ufl.edu writes:
>I shouldn't say ANY compilor here. It is impossible to
>try all the compilors. I actually tried on the Ultrix4.02
>VMS and BORLANDC++2.0.
>Here is the bug.
>----------------------------------------------
>/** bug: the scanf() gets() cant be together  **/
>/** fix: move scanf() after gets()  **/
>
>
>
>#include <stdio.h>
>
>int main(void)
>{
>   char string[80];
>   int num;
>
>   printf("Enter a number: ");
>   scanf("%d",&num);
>   printf("The number was: %d\n",num);
>
>   printf("Input a string:");
>   gets(string);
>   printf("The string input was: %s\n",
>     string);
>   printf("Input another string:");
>   gets(string);
>   printf("The 2nd string input was: %s\n",
>     string);
>   return 0;
>}
>
>
>---------------------------------------------
>
>
>Zhuo

	I really don't see where's the bug!  Just remember that
	"scanf" doesn't read anything after the number including
	the end of line ('\n').

	That's not a bug.  That's a documented feature ;-)


-- 
Jean-Claude Nadeau, ing.	<nadeau@JSP.UMontreal.CA>
Services informatiques		<nadeau@ERE.UMontreal.CA>
Universite de Montreal		<nadeau@UMTLVR.BITNET>
Tel. (514) 343-6111,ext 5234	Fax  (514) 343-2155
From: wilde@tigger.Colorado.EDU (Nick Wilde)
Subject: C++ as a 1st programming language ?
Organization: University of Colorado, Boulder
Date: Tue, 14 Apr 1992 20:28:24 GMT


Greetings - How would you rate C++ as a language to 
*teach* programming in, from the beginning ?

Also, can anyone recommend an "Intro to C++" book which does
*not* assume a background in another programming language ?
For instance, would the Booch book, that gets such glowing
reviews in this forum, suffice ?

My advisor finds himself in the position of teaching the "Intro
to Programming" class for CS majors next semester. At this
point, he's trying to decide what language to use to best get 
across the concept of programming as a problem solving process,
rather than getting hung up on the syntatical issues of any one
language. 

He's considering C++, without knowing a lot about it.  How would
you, as a C++ guru, rate the language for a teaching a beginner
to program in ? Does C++ hide some of the stickier syntactic
foibles of C, or does all that come shining through ? (For
instance, the infamous = and == confusion that every beginning
C programmer falls prey to once upon a time).

Thanks
	-Nick

P.S. E-mail replies or posting is fine - I don't normally keep tabs
on this group but will for a while to see what turns up. This doesn't
seem like a question of general import to this group, however,
so e-mail might be a better choice. I'll summarize if there's 
interest.



-- 
----------------------------------------------------------------------------- 
      Nick Wilde         |  "The truth is rarely pure and   
 wilde@cs.colorado.edu   |          never simple"          - Oscar Wilde 
-----------------------------------------------------------------------------
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c++
Subject: Re: Best C++ Books
Date: 13 Apr 92 03:21:29 GMT
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Liberty Corner NJ

In article <703113925.F00001@csource.oz.au> Ranjit.Thomas@f506.n712.z3.fx.cec.edu.au (Ranjit Thomas) writes:

> Coplien's book "Advanced C++ programming styles and idioms " is 
> worth looking at.

Yes indeed -- but not until you understand the fundamentals of the
language.  Take the `Advanced' in the title to heart -- the book shows
some rather unusual programming techniques and it is up to you to decide
when to use them.
-- 
				--Andrew Koenig
				  ark@europa.att.com
Newsgroups: comp.lang.c++
From: exuhag@exu.ericsson.se (James Hague)
Subject: Re: C++ as a 1st programming language ?
Organization: Ericsson Network Systems, Richardson, TX
Date: Thu, 16 Apr 1992 16:37:47 GMT

Mark C. Carroll writes:
>
>In addition, C++ compilers tend to give _confusing_ errors, C++
>debuggers tend to be difficult to use, and the compiler doesn't check
>for the kinds of errors that students are most likely to make.

I'll agree here.  Most beginners tend to completely miss many
concepts and use them in all sorts of weird ways.  They need
as much feedback as possible as to what went wrong.  It is WAY
too easy to goof things up using C/C++.  Something as simple as
a string comparison can send your program off the deep end without
much warning.  A first course in programming should teach
the *concepts* of programming and not have to worry about
all sorts of weird stuff.

Something else you don't want is students equating programming
with programming in C++ (or some other language).  This is
the way that most COBOL programmers end up.  C++ is not
perfect and it will not last forever.  And there are lots
of concepts which are handled better in other languages.  It
would probably be best to use several different languages and
then go into C++ later  (by that time most students could
probably pick it up on their own anyway, especially with
prior exposure to any other procedural language and either
Smalltalk or Eiffel).

--
James Hague   
exuhag@exu.ericsson.se
Newsgroups: comp.lang.c++
From: jimad@microsoft.com (Jim ADCOCK)
Subject: Re: Brainteaser
Date: 09 Apr 92 20:07:16 GMT
Organization: Microsoft Corp.

In article <TOM.92Apr1145643@amber.ssd.csd.harris.com> tom@ssd.csd.harris.com (Tom Horsley) writes:
|Warning: I don't have the answer to this, it is just a foolish question
|I got to thinking about today (probably suitable for April fool's day):
|
|   Is it possible to write a C++ routine which, at runtime, can determine
|   if it was expanded inline or not?
|
|(I suppose you could argue that if it is possible, the compiler shouldn't
|have inlined it, since the semantics obviously changed :-).

One could argue such, but one would be wrong.  On the contrary the answer is:

"Yes, But"

I leave the implementation and the caveat as an exercise for the reader ;-)
From: andrew@lsa.ncl.omron.co.jp (Andrew Walduck)
Newsgroups: comp.lang.c++
Subject: naming conventions for methods
Date: 16 Apr 92 10:26:53 GMT
Reply-To: andrew@lsa.ncl.omron.co.jp (Andrew Walduck)


I'm looking for a means of naming methods according to what they do...
does anyone out there have a "standard"??

For example (method types...)
  constructors --  they construct (or create) an object
  destructors  --  they destroy an object
  inspectors   --  they return information about the state of the object  
  modifiers    --  they modify the state of the object
  operators    --  they allow manipulation of an object through symbols such
                   as = , ==. < etc..

For objects...
  iterators  -- used as read-only "indices" into a collection...
  manipulators -- used as read-write "indices" into a collection...

Any others?? (Any corrections to my definitions?? ;-)

Cheers.
Andrew



Andrew Walduck -- OMRON Japan -- andrew@lsa.ncl.omron.co.jp 
-------------------------------------------------------------------------------
Henry Spencer says "Retch barf." 
-------------------------------------------------------------------------------
Newsgroups: comp.lang.c++
Subject: floating point behaviour in BCC
From: psyxsgp@otago.ac.nz
Date: 16 Apr 92 11:05:50 +1300
Organization: University of Otago, Dunedin, New Zealand


	You can control floating point exceptions in BCC ver 3
using the _control87() and associated library functions.
By masking control87() off you can then monitor floating point
status flags without aborting the running of your program.
	In order to debug some code I wrote I did this, and observed
some odd behaviour.

	consider
	
	float dOut = dInt0*CONSTANT_INT+dInt1+dFloat;
	_clear87();
	cout << dOut << "\n";
	FloatPointStatus();

where FloatPointStatus is a simple routine using _status87() to
print out the flag status in a readable format.

	This section of code produces an "inexact"  floating point 
status flag even when dInt0 CONSTANT_INT dInt1 and dFloat
are all samll reasonable values.

	Could someone explain why this occurs for me please

-- 
Stephen Pearce, University of Otago, Dunedin, New Zealand.
ph 064-3-7470999 ext 8166 home 064-3-4763778
From: urcml@unix.cis.pitt.edu (Mun L Chan)
Newsgroups: comp.lang.c++
Subject: NIH Class library
Keywords: NIH
Date: 17 Apr 92 13:38:07 GMT
Organization: Univ. of Pittsburgh, Computing & Information Services

Hi,

Sorry if this is has been asked before but I read the FAQ and in
QUestion 96 it mentions the NIH Class library and how to get hold
of it.  My trouble is not being able to log into that site.  Can
someone tell me if there is an alternate site or other ways to
get the Classes?  Thanks,

M.L. Chan
Newsgroups: comp.lang.c++
From: jimad@microsoft.com (Jim ADCOCK)
Subject: Re: A really good way to do this is?
Date: 13 Apr 92 20:57:16 GMT
Organization: Microsoft Corp.

In article <1992Apr8.004446.3033@ncsu.edu> easchwei@eos.ncsu.edu (ERIC ARNOLD SCHWEITZ) writes:
|Hi, I am having a problem seeing how to do the follwoing in C++
|and was wondering if anyone out there has done it and/or has
|some good thoughts on the subject.
|
|The problem at hand is I'd like to be able to define a general
|class which I can inherit from that has a the following property:
|each time a member function is called a hidden member function,
|eg. an access function, is called and when the member function
|exits a `deaccess' function is called.  This is similar to, but not
|really the same, as the constructor/destructor pair for an
|object, but I wish for it to happen on each access.

I don't believe C++ offers a "good" solution to this problem
[although adding operator dot would be a partial set in the right direction]
See the below "not-too-good" example which illustrates some of the issues
and associated problems:


extern "C"
{
	#include <stdio.h>
}
	
class X;

class dispatch
{
	X& xref;
public:
	dispatch(X& x);
	~dispatch();
	X* operator->();
};

class X
{
	char name;
public:
	X(char c) : name(c) { }
	void doSomething() { printf("doSomething with %c\n", int(name)); }
	void lock() { printf("lock %c\n", name); }
	void unlock() { printf("unlock %c\n", name); }
	dispatch operator->() { return *this; }
};

dispatch::dispatch(X& x) : xref(x) { xref.lock(); }
dispatch::~dispatch() { xref.unlock(); }
X* dispatch::operator->() { return &xref; }

main()
{
	X x('x');
	printf("++++++\n");
	x->doSomething();
	printf("------\n");
	x.doSomething();
	return 0;
}
From: rmartin@willing.Rational.COM (Bob Martin)
Newsgroups: comp.lang.c++
Subject: Re: Reference for Object Identification?
Date: 15 Apr 92 00:01:00 GMT

You will find Stroustup`s proposal for "Run-time type information" in
section 13.5 of "The C++ Programming Langauge" Second Edition.

Stroustrup has also an article in the March/April C++ Report which
discusses the same subject....


jamesh@cs.umr.edu (James Hartley) writes:

>I vaguely remember that Stroustrup, et. al. were writing a paper/proposal
>for objects to identify themselves.  I would appreciate if someone could
>tell me where this can be found.  Thanks.



--
+---Robert C. Martin---+-RRR---CCC-M-----M-| R.C.M. Consulting         |
| rmartin@rational.com |-R--R-C----M-M-M-M-| C++/C/Unix Engineering    |
|     (Uncle Bob.)     |-RRR--C----M--M--M-| OOA/OOD/OOP Training      |
+----------------------+-R--R--CCC-M-----M-| Product Design & Devel.   |
Newsgroups: comp.lang.c++
From: jimad@microsoft.com (Jim ADCOCK)
Subject: Re: how to implement  a[i] = b[j] + c[k] ?
Date: 09 Apr 92 20:01:58 GMT
Organization: Microsoft Corp.

In article <1992Apr3.191652.193@chpc.utexas.edu> aort552@chpc.utexas.edu (Weihan Robert Wu) writes:
|I am kind of new for learning C++.  One thing confusing me recently is
|that it seems there is no easier way to do the following class assignment.
|
|   a[i] = b[j] + c[k] ;
|
|where a , b , c are in the same class.

Not sure I understand your question, but in general the problem is that
while a, b, c of the same class, a[i], b[j], c[k] are of a different type,
and the "=" may or may not be a class assignment, depending on what you're
trying to do.  If these other types are built-ins, then the problem isn't
particularly complicated.  Hansen's "C++ Answer Book" has examples of this,
I believe.

Newsgroups: comp.lang.c++
From: em@nynexst.com (Edward Man)
Subject: Casting int to some class question
Organization: Nynex Science & Technology
Distribution: na
Date: Fri, 17 Apr 92 20:48:13 GMT

Is the following possible? If so, how? Can someone tell me?

How to type cast a standard type to some class? For example,
this example gives you an idea of what I want

class	Element
{
public:
	int	x;
	char	y;
	int	z;
	operator Element(int);	<-- I need a way to accomplish this.
};

main()
{
	Element	a;

	a = (Element) 10;
}

What I want from "(Element) 10" is:

Element Element::operator Element( int num )
{
	
	x = num;
	
Newsgroups: comp.lang.c++
From: rae@alias.com (Reid Ellis)
Subject: Re: Paradigm problem (maybe)
Organization: Alias Research, Inc., Toronto ON Canada
Date: Tue, 7 Apr 1992 02:49:58 GMT

Tom B <tom@clam.UUCP> writes:
|class my_class {
|protected:
|	int		x1, x2;
|	int		y1, y2;
|public:
|	virtual void Draw(my_view	*view) {}		// draw it on the screen
|	virtual void Write(FILE *fp) {}				// write it to a file
|	virtual void Print(...) {}					// print it to the correct printer
|}
|
|Anyhow the question is how do I setup Print to Print to the correct
|type of printer.  I really don't want to have PSPrint (postscript),
|and HPPrint.

How about dclaring Print a bit differently, as in:

	virtual void Print(Printer &, ...);

with a [virtual] base class, Printer with standard calls, like
drawLine() etc.  Actually, it doesn't even have to be a printer.  This
is how generic graphics libraries are born.  Just use something
called, say, a GraphicsContext, and do all drawing onto that, as in:

	virtual void SetGraphicsContext(GraphicsContext &);

and then you could have code like this:

	my_class foo;
	PSPrinter ps;
	VGAScreen screen;

	foo.SetGraphicsContext(screen);
	foo.Draw(aView);
	foo.SetGraphicsContext(ps);
	foo.Draw(aView);

Alternatively, make every call accept a context [maybe that's what
your view is?]  Or have methods like this:

	virtual void Draw(my_view *, GraphicsContext * = NULL);

so that you can say either:

	foo.Draw(aView, screen);

or
	// exactly as above...
	foo.SetGraphicsContext(screen);
	foo.Draw(aView);

whatever turns your fancy.

etc, etc, etc, etc.  You get the drift.. [I'm raving.]

						Reid
--
Reid Ellis                                            
rae@utcs.utoronto.ca        ||           rae@Alias.com
CDA0610@applelink.apple.com ||  +1 416 362 9181 [work]
Newsgroups: comp.lang.c++
From: morss@eksignal.kodak.com (Charlie Morss)
Subject: Info on development tools
Organization: Eastman Kodak
Date: Thu, 16 Apr 92 16:36:19 GMT

The department I'm working in is in the process of purchasing
some new Sun SparcStations (IPCs,IPXs, and SS2s). We will be 
using these machines as a "front end" for a real-time data
collection/analysis system.  The goal is to move some of the
nonreal-time functionality onto the Sparcs. 

This is a large project and what I'm doing now is looking for
development tools. I've read with interest the info on the 
various class libraries but I would like some info on various
compiler/debugger/edittor environments. I realize Sun has
their own C++ compiler but I'd like to hear peoples opinions of
other compilers as well. 

On a related note: How well does the DevGuide C++ output do as 
far as implementing true OOP? Is this code truely OO? Does UIT
help with this in a realistic manner (ie. fast enough, not 
too difficult to use, etc)?

Thanks in advance,

Charlie


-- 
-----------------------------------------------------------------
Charlie Morss                               Voice: (716) 726-5461
morss@eksignal.kodak.com                      Fax: (716) 726-4850 
-----------------------------------------------------------------
Newsgroups: comp.lang.c++
From: mjv@objects.mv.com (Michael J. Vilot)
Subject: Re: Best C++ Books -- Need Opinions!!!
Organization: ObjectWare, Inc.  Nashua NH USA
Date: Thu, 09 Apr 1992 15:56:49 GMT

> Scott Silvey:
> % Object Oriented Design with Applications
> % 	Grady Booch
> How is this book?  Is this the same guy who designed the Booch library?

I think it's quite good.  Yes, it's the same guy.

> Is the book C++ oriented?  Does it have code for working applications?

Not specifically:  it presents examples in C++, CLOS, Smalltalk, Object
Pascal, and (for historical reasons) Ada.  The code is there to indicate
how the design would be realized, but there are not complete, runnable
applications of the kind you might find in a typical C/C++ for Windows
book. 

> I am looking for something that covers how to "THINK object oriented"

I think this book is about the best you can find for that purpose. For
what it's worth, the folks at Computer Language magazine seem to agree
-- they gave the book a "Jolt" award (last year's winner was the
Annotated C++ Reference Manual).

---
Mike Vilot		ObjectWare, Inc.		Nashua NH
mjv@objects.mv.com
Xref: sparky comp.lang.c++:6786 comp.std.c++:396