HDTenEightyP/NetNews huggingface dataset:
Date: Tuesday, 26 January 1993 21:59:04 EST
X-Mailer: TMail version 1.14R
From: "Tim Triemstra" <empath@ais.org>
Organization: Empath Software
Subject: Compiling a string class
Newsgroups: comp.lang.c++
Distribution: world

I've been having trouble getting these lines of code to compile
correctly under Zortech C++.  It works fine under BC++ so I'm kinda
baffled.  Even more so, the error is kinda oblique (not realy alot of
room for another ')' y'know.)

Any ideas what could be causing this?

---
ztc -mx -c str.cpp strsearch.cpp regx.cpp match.cpp dynstream.cpp
ztcpp1x -DDOS386 -3 -ms -oC:\UTILS\TEMP\ztc_1.tmp str.cpp
   str(const char *, const str::substr& );
                                      ^
str.h(123) : Error: ')' expected
   friend str operator+(const char *, const str::substr & );
                                                        ^
str.h(250) : Error: ')' expected
   int operator==(const char *, const str::substr & );
                                                  ^
str.h(293) : Error: ')' expected
   int operator<=(const char *, const str::substr & );
                                                  ^
str.h(294) : Error: ')' expected
   int operator>=(const char *, const str::substr & );
                                                  ^
str.h(295) : Error: ')' expected
Fatal error: too many errors
--- errorlevel 1
--------------------------------------
Thanks folks.
Tim.


-------------------------------------------------------
| When the end comes, there will be two men standing: |
|   Me, and the guy I gotta kill.   - Gosh I'm EVIL   |
------ Tim Triemstra ------------- empath@ais.org -----
From: je@unix.brighton.ac.uk (John English)
Newsgroups: comp.lang.c++
Subject: Re: overloading templates
Date: 22 Jan 93 14:41:55 GMT
Organization: University of Brighton, UK

pluym@cs.kuleuven.ac.be (Luc Pluym) writes:
: FIRST QUESTION
: ==============
: Can I have 
: 
: template <class T1>
: class A {...};
: 
: and
: 
: template <class T1,class T2>
: class A {...};
: 
: at the same time?

	No. Templates can't be overloaded.

: SECOND QUESTION
: ===============
: Suppose I have
: 
: template <class T,int i>
: class B {...};
: 
: and also
: 
: template<class T,double d>
: class B {...};

	No. Templates can't be overloaded.
-- 
-------------------------------------------------------------------------------
John English			| Fudd's first law of opposition:
Dept. of Computing		|    If you push something hard enough, it
University of Brighton		|    *will* fall over.
E-mail: je@unix.brighton.ac.uk	| Testlicle's deviant to Fudd's law:
Fax:    0273 642405		|    What goes in, must come out.
-------------------------------------------------------------------------------
Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Friend ..Overload Assignment opertr ..
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Wed, 27 Jan 1993 14:26:04 GMT

In article <C19838.JM3@cs.uiuc.edu> pjl@cs.uiuc.edu (Paul Lucas) writes:
>In <1993Jan22.075317.21062@usl.edu> rks9954@usl.edu (Srinivasa Rao K) writes:
>
>>       I am writing a "string"  class which i should be able
>>       to use like
>
>>       string str1;
>>       str1 = "Hello world" ;
>
>>       But We canot use a friend to overload the assignment oprator.
>>      So finally  I had to convince myself to use something like
>
>>       str1 <= "Hello world"
>
>>       which works.
>
>>      Is there any way to do the first method ....
>
>	No.  operator=() must be a member.  Period.  Everybody defines it
>	this way and has no problem.  Whats wrong with it being a member?

	Actually, I suggest instead a constructor:

	string::string(char *);

Then you dont need to bother with assignment from a char*:

	string s;
	s="Hello";

will work because the assignment operator:

	operator=(const string&)

will cause conversion from char* to string before doing the assignment.
This is less efficient but simpler.

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;------ SCIENTIFIC AND ENGINEERING SOFTWARE ---ph:  2 799 8223 --------
Xref: sparky comp.lang.c++:20057 comp.std.c++:2140
From: davidm@consilium.com (David S. Masterson)
Newsgroups: comp.lang.c++,comp.std.c++
Subject: Re: Callbacks -- suggested approaches??
Date: 28 Jan 93 19:10:29 GMT
Organization: Consilium Inc., Mountain View, California
In-reply-to: spencer@cats.ucsc.edu's message of 26 Jan 93 18:55:11 GMT
X-Posting-Software: GNUS 3.13  [ NNTP-based News Reader for GNU Emacs ]

>>>>> On 26 Jan 93 18:55:11 GMT, spencer@cats.ucsc.edu (Michael Spencer) said:

>                          WIDGET CALLBACKS

> Widgets which use callbacks are similarly easy. XSimple widgets attach their
> own callback and pass to it a reference to a coder written Procedure. The
> callback calls the Procedure and passes to it a Choice object which contains
> the data needed to respond to the event.  For example, to activate a popup
> dialog widget:

>           PopupYesno (parent, "Do it ?", YesnoProc);   // evoke popup
>           void YesnoProc (Choice chose)    // coder written to handle event
>                {
>                if (chose.flag)
>                     // do something
>                else
>                     // do something else
>                }

> The coder written YesnoProc() defines what occurs based on the user's
> election. Choice is an object (declared in XUTILS.H) which will hold any
> information generated by any callback or event handler.

> BUT, the coder need not become involved in the sordid details of adding the
> callback to the widget or extracting the relevant information from the
> returned callback struct. That is done automatically and the relevant
> information is passed via the Choice data members.

An interesting variation on the X-windows approach.  However, I see a few
(what I would call) holes in what you've shown above:

1.  I assume PopupYesno is an object.  If so, why isn't YesnoProc() a member
function of the object?  Wouldn't that help for maintenance?

2.  Your Choice object appears to carry a type flag.  Couldn't things be done
virtually and eliminate this flag?

3.  What if the information generated for a callback is not of type Choice?
--
====================================================================
David Masterson					Consilium, Inc.
(415) 691-6311					640 Clyde Ct.
davidm@consilium.com				Mtn. View, CA  94043
====================================================================
"I'll put an end to the idea that a woman's body belongs to her . . . the
 practice of abortion shall be exterminated with a strong hand."
-- Adolf Hitler, _Mein Kampf_
Xref: sparky comp.lang.c++:19698 comp.object:4981
From: mcampbel@cs.ucf.edu (Mike Campbell )
Subject: Re: HELP : Array of objects of diff classes ??
Organization: University of Central Florida
Date: Sun, 24 Jan 1993 13:17:29 GMT

campbell@src.honeywell.com (Terry Campbell) writes:


>In article <1993Jan19.112059.2882@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:

>>Dear Everybody,
>>
>>
>>	I have a problem related to programming in an object oriented fashion.
>>	Here`s the problem description :
>>        There is an object class called Holder. The object holder can hold various
>>        things : Pencils, Pens, Erasers etc. I`ve declared different classes for
>>        these things ( class PENCIL, class PEN, class ERASER etc. ). 
>>
>>        The user of this program will choose at the runtime what objects to put
>>        in the holder. The problem is how do i store this information (i.e the
>>        contents ) in class HOLDER. I cannot create a single array of objects
>>        because each object is of different class.
>>	

>I assume that it reasonable to allow Holder to hold any one of these objects
>because there is some similarity between these objects.  e.g., they are all
>drawing tools or whatever.  This concept of similarity should be captured by
>classifiying each of these item classes as subclasses (or specializations) of
>the common class (e.g., drawing_object - which may be abstract).  Then, the
>Holder class simply has to be declared to be able to hold objects of type
>drawing_object.  Then, any instance of PENCIL, PEN, ERASER and any other class
>derived from drawing_object cam be held by a Holder instance.  Aggregates can
>hold heterogeneous collections etc.

I've been following this thread with some interest, and I find your reply 
interesting.  

I agree with your analysis of the problem re: subclasses, however, what if
you buy/purchase/steal classes from multiple vendors/coworkers/victims ?
They necessarily will not have a common base class.  (Or is this correctly
deemed "superclass?")

Borland does this - they have a common base class, "Object", as I recall, and
all of the storage classes can hold 'objects'.  This allows the storage 
classes to hold just about anything in their provided class library, as every-
thing is derived from the 'object' class.

Any ideas/thoughts from anyone on how to handle dissimilar base classes in a
'holder' class?


Newsgroups: comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: Virtual function call within constructors
Organization: TauMetric Corporation
Date: Sun, 24 Jan 1993 16:47:09 GMT

gschwarz@dcc.uchile.cl (Guillermo Schwarz Utrup) writes:

To: gschwarz@dcc.uchile.cl
Subject: Re: Virtual function call within constructors
Newsgroups: comp.lang.c++

In comp.lang.c++ you write:

>I have found that virtual functions are not handled as one could expect
>when called from a constructor.

That is because you are not expecting the right thing.  Look up
virtual functions in constructors in any good C++ text.

When constructing a base class, only functions visible from that class
constructor can be called.  The derived class has not been constructed yet,
so you can't call any of its functions.  For example, the derived version
of the virtual function might depend on data set up by the derived
constructor, which won't have yet been called.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Newsgroups: comp.lang.c++
From: riff@inf.utfsm.cl (Maria Cristina &)
Subject: Binary Trees Implemented in C++
Date: Thu, 21 Jan 1993 16:53:03 GMT
Organization: Informatica UTFSM
X-Newsreader: TIN [version 1.1 PL8]


Hi!,

   I need information about books or programs where I should can find
   topics to program a binary trees (classification and regression trees)
   in C++.

   Thanks,

   M.Cristina. (riff@inf.utfsm.cl)
   
Newsgroups: comp.lang.c++
From: pjl@cs.uiuc.edu (Paul Lucas)
Subject: Re: Trouble With extern declaration in g++-2.3.3
Organization: University of Illinois at Urbana-Champaign
Date: Thu, 21 Jan 1993 19:15:41 GMT

In <C17GJ6.9Gu@dcs.ed.ac.uk> nm@dcs.ed.ac.uk (Neil Mackinnon) writes:

>I wonder if anyone out there could help me with a small problem I am 
>having.

>I am writing classes that will be linked with code generated by another 
>program to form a simulation program that will carry out a simulation of a
>systolic array. Within one of the classes I have a declarations

>      extern int NO_OF_PORTS; 
>	
>      static portElem externalData[NO_OF_PORTS];

>To say how many connections the array will have to the outside world.
>it is an extern declaration because the code that is generated by my
>main program will assign it a particular value according to the particular
>array I am simulating. The compiler (g++-2.3.3) I am using is not allowing 
>me to generate an unlinked object file for the class but is giving me 
>the error message 

>../include/arrayIo.h:22: variable-size type declared outside of any function

>I have not been using C++ for long and have never seen this error before
>if anyone could help I would be most greatful.

	It's saying that because it's illegal.  The size of static
	vectors must be known at compile-time.  No exceptions.
-- 
	- Paul J. Lucas
	  AT&T Bell Laboratories
	  Naperville, IL
From: jamshid@emx.cc.utexas.edu (Jamshid Afshar)
Newsgroups: comp.lang.c++
Subject: Re: is 'this' obsolete??!!
Date: 21 Jan 1993 19:29:06 -0600
Organization: The University of Texas at Austin, Austin, Texas
NNTP-Posting-Host: emx.cc.utexas.edu
Summary: BC++ documentation error.  Should say "assignment to this ..."

>>I recently heard someone mention that the use of 'this' is obsolete,
>>and that another method is preferred...  I've forgotton how, sorry.
>>I also found this claim in the on-line help of Borland C++ 3.1.

>Me too - all of the Borland manuals and help files claim 'this' is obsolete,
>and should be replaced by some method using the new operator...naturally,
>they don't give an example, so I continue to use 'this'.  Any suggestions?

That's an error in the Borland documentation (in on-line help's "BC++
Language"|"Keywords"|"this").  It should say "assignment to 'this' is
obsolete".  If you don't know what "assignment to this" is, good.  It
was an early (before cfront 2.0) way to choose a different method of
memory allocation when one new's a class object.  The modern, more
efficient and safer way is to overload the class' operator new() and
delete().

Every C++ programmer should have either or both Stroustrup's _C++
Prog. Lang. 2nd Ed_ and Lippman's _C++ Primer 2nd Ed_.  Don't rely on
a compiler's manuals to learn the language (then again, don't rely on
most of the C++ books out there to learn the language :-/).

Jamshid Afshar
jamshid@emx.utexas.edu
Newsgroups: comp.lang.c++
From: pvonk@scott.skidmore.edu (Pierre VonKaenel)
Subject: TVision: prevent closing windows?
Organization: Skidmore College, Saratoga Springs NY, 12866
Date: Tue, 26 Jan 1993 13:29:07 GMT


I would like to have a window on the screen that never closes (the
class is never destroyed until the end of the program), but may be
toggled between hidden and displayed.  I found how to prevent having a
close icon (upper left corner), but how can I prevent it being closed
using the "Window | Close" command from the menu bar (I want to allow
other windows to close).  Is there a simple flag to do this, or do I
have to write a handleEvent() and intercept cmClose events?

Thanks....  


-- 
Pierre von Kaenel  |  Math & CS Dept | Skidmore College | pvonk@skidmore.edu
----------------------------------------------------------------------------
Ads from premier issue of PC Tech Journal (Jul 83): 20MB Hard disk from
QCS - Cost: $2999.   Davong 5 MB int. hard disk... only $1465!
Newsgroups: comp.lang.c++
From: c0365384@discus.technion.ac.il (Esteban D. Schnir)
Subject: Re: Borland C++ & TVision
Organization: Technion, Israel Institute of Technology
Date: Thu, 21 Jan 1993 23:02:06 GMT

Neal Sanche (Neal.Sanche@ttlg.UUCP) wrote:
: To: chris@cad.gatech.edu (Chris McClellen)
:  On 01-09-93 Chris McClellen wrote to All...

:  CM> I am using Borland C++ 3.1 with TVision.  Currently, I am running
:  CM> into a problem with the Help subsystem....

:  You require the patches to Borland C++ 3.1. There is a patch for the
:  assertion error included.

:  -Neal

: ... OFFLINE 1.41

:  * Origin: Paradigm BBS: A programmer's paradise. (42:100/11)

I know 3 pathches for BC++ 3.1 but no one of them modify nothing in
TVision.
Which patch are you talking about?

--
Esteban D. Schnir                             c0365384@TechSt02.Technion.Ac.Il
Department of Computer Engineering                 bs778@Cleveland.Freenet.Edu 
Technion - Israel Institute of Technology                eschnir@Nyx.Cs.Du.Edu 
Tel.:+(972)-(4)-294538                                   Fax:+(972)-(4)-223854
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c++
Subject: Re: References to functions?
Date: 27 Jan 93 19:28:38 GMT
Organization: negligable

In article <1993Jan21.173352.10406@taumet.com> steve@taumet.com (Steve Clamage) writes:
>fritz@mtl.mit.edu (Frederick Herrmann) writes:
>
>>I tried to declare a reference to a function, but found that g++
>>wouldn't let me.  After scanning ch. 8 of the ARM, I interpret it to
>>forbid function references, but it's not all that clear (see below).
>
>References to functions are legal, but not very useful.  I can't
>think of anything you can do with a reference to a function you
>can't do with a const pointer to a function in exactly the same way,
>except for trivial syntax differences at the point of initialization.
>You use them in exactly the same way.

There is one big difference between pointers & references, whether
we are discussing functions or just data.

A pointer may be uninitialized, or NULL, and cannot be used safely
without testing.

A reference is guaranteed to be initialized.

Aside from the notational convenience, this guarantee can make some 
code more efficient.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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: kanze@us-es.sel.de (James Kanze)
Subject: Re: Is (p) instead of (p!=NULL) portable? 
Organization: SEL
Date: 28 Jan 93 19:26:23

In article <1993Jan26.091708.11214@cbfsb.cb.att.com>
nh@cbnewsg.cb.att.com (nicholas.hounsome) writes:

|> From article <1993Jan25.125627.29030@ugle.unit.no>, by robert@alkymi.unit.no (Robert Schmidt):
|> > 
|> > In PC C's, the NULL pointer is defined with a bit pattern of all zero's,
|> > and the constructs 
|> >       if (p)
|> > and
|> >       if (!p)
|> > checks for NULL and non-NULL respectively.  Is this portable to *all*
|> > platforms?
|> > 
|> > 
|> > Robert

|> It is NOT portable for C.

Yes it is.  There is no difference between ANSI C and C++ in this
regard.

|> It is portable for C++ which is the group that you have posted to -
|> did you mean to?

|> #define NULL (void*)0
|> if(p==NULL)

|> This is WRONG in C++ and right in C.
|> (char*)0 is even worse in C++.

And equally wrong in C.
--
James Kanze                             email: kanze@us-es.sel.de
GABI Software, Sarl., 8 rue du Faisan, F-67000 Strasbourg, France
Conseils en informatique industrielle --
                   -- Beratung in industrieller Datenverarbeitung
From: ychung@news.cis.ohio-state.edu (yiu fai chung)
Newsgroups: comp.lang.c++
Subject: What is bus error ??
Date: 27 Jan 93 14:41:51 GMT
Organization: The Ohio State University Department of Computer and Information Science

Sometime I got strange error message like "bus error" when I was using
C++. Does anyone know the reason ?




-- Phil.
From: cshaver@informix.com (Craig Shaver)
Newsgroups: comp.lang.c++
Subject: Re: C++ develpment environments
Date: 20 Jan 93 20:38:55 GMT
Organization: Informix Software, Inc.

In article <1993Jan20.125059.15914@cbnewsh.cb.att.com> wolf@merlin.mt.att.com writes:
>In article 11431@netcom.com, erc@netcom.com (Eric Smith) writes:
>"
>"> "I heard a rumor that ObjectCenter costs $4000 per copy.  Is this true?
...
>
>First rule of a free market is: charge what the market will bear.  Since there aren't
...
>when compared to a PC product such as Borland C++...until CenterLine releases the

Just wait until the PC market goes full 32 bit across the board.  It may take 5
years, but it will happen.  UNIX and UNIX based products may be eliminated by 
the unwashed rabble from Redmond.

....

>
>Just my $.02,
>Tom
>
>---
>+----------------------------------------+ ..I've been told my signature lacked
>| Thomas Wolf   | (908) 957-3955         | originality...Of course it does!
>| Bell Labs, NJ | wolf@merlin.mt.att.com | I'm a conservationist - and 
>| MT 4D-213     | wolf@jolt.att.com      | originality, in my case,  is a
>+----------------------------------------+ an extremely limited resource...


-- 
Craig Shaver  (cshaver@informix.com for now) (415)390-0654 (415)926-6407
Productivity Group POB 60458 Sunnyvale, CA  94088
Newsgroups: comp.lang.c++,comp.object
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: HELP : Array of objects of diff classes ??
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Wed, 27 Jan 1993 17:18:12 GMT

In article <mcampbel.727881449@eola.cs.ucf.edu> mcampbel@cs.ucf.edu (Mike Campbell ) writes:
>campbell@src.honeywell.com (Terry Campbell) writes:
>>> There is an object class called Holder. The object holder can hold various
>>> things : Pencils, Pens, Erasers etc. I`ve declared different classes for
>>> these things ( class PENCIL, class PEN, class ERASER etc. ). 
>>>
>I've been following this thread with some interest, and I find your reply 
>interesting.  
>
>I agree with your analysis of the problem re: subclasses, however, what if
>you buy/purchase/steal classes from multiple vendors/coworkers/victims ?
>They necessarily will not have a common base class.  (Or is this correctly
>deemed "superclass?")

	Best not to use the words 'superclass' and 'subclass' in C++.
Stick to 'base' class and 'derived' class.

>
>Borland does this - they have a common base class, "Object", as I recall, and
>all of the storage classes can hold 'objects'.  This allows the storage 
>classes to hold just about anything in their provided class library, as every-
>thing is derived from the 'object' class.

	They USED to do this in the older and hopefully now
defunct class library. The newer BIDS library does not use this
woeful technique :-)

>
>Any ideas/thoughts from anyone on how to handle dissimilar base classes in a
>'holder' class?
>
	As I originally posted, you use the construct that
was designed to IMPOSE similarity on disimlar classes,
namely the humble union. You will have to add some type information
to the union:

	struct WritingTool {
		enum {tPen, tPencil, tEraser } tag;
		union {
			Pen pen;
			Pencil pencil;
			Eraser rubber;
		};
	};

It would be better IMHO if this was supported directly by the compiler.

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;------ SCIENTIFIC AND ENGINEERING SOFTWARE ---ph:  2 799 8223 --------
Newsgroups: comp.lang.c++
From: doug@monet.ads.com (Doug Morgan)
Subject: Re: Question About Code In ARM
Organization: Advanced Decision Systems, Mountain View, CA 94043, +1 (415)
	960-7300
	<1993Jan20.233819.24771@ucc.su.OZ.AU>
Date: Thu, 21 Jan 1993 23:11:05 GMT

In article <1993Jan20.233819.24771@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
   In article <1993Jan20.014738.8501@ctp.com> dchen@ctp.com (Denys Chen) writes:
   >(In another word, can we remove ", public virtual W" ?) 
   >                                 ^^^^^^^^^^^^^^^^^^

	   Depends. The requirement "you can only initialise an
   immediate base"...

Actually, the ARM statement (pg. 290) is "Initializers for immediate
base classes ... may be specified in the definition of a constructor."
It doesn't come right our and say ONLY immediate base classes can be
initialized.  Of course, the (supposedly superfluous) commentary seems
to think this when it says "Disallowing the initialization of indirect
bases...".  In any case, someone (I think it was Stephen Clamage) said
the (quasi-implied) restriction has been tossed from the latest
version of the proposed standard.

Hopefully the sections on virtual base classes for the final standard
will be heavily edited by someone with a nack for logical expression
in English.  Those sections are really a mess in the ARM.

   -- 
   ;----------------------------------------------------------------------
	   JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	   Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
   ;------ SCIENTIFIC AND ENGINEERING SOFTWARE ---ph:  2 799 8223 --------
Newsgroups: comp.lang.c++