HDTenEightyP/NetNews huggingface dataset:
From: jimad@microsoft.com (Jim Adcock)
Subject: Re: Automatic conversion! Can we do this?
Date: 24 Dec 92 18:59:06 GMT
Organization: Microsoft Corporation

In article <1h7sq8INNr7e@function.mps.ohio-state.edu> ren@function.mps.ohio-state.edu (Liming Ren) writes:
|string a, b("Merry");
|a=b+" Chrismas";
|a="C" + b;
|
|But I can't do:   a="Merry" + " Chrismas";
|The compiler complains that "pointer +pointer" and the conversion does not 
|happen. I tried to overload + with (char*, char*). The compiler did not 
|allow me. 

The language does not allow you to do this.  Overloaded operators must
take at least one parm of class type.  (ptr + ptr) is defined to be an error
by the language and you cannot overload this behavior because of the previous
rule.  The closest you can come is:

	a = (string) "Merry" + " Christmas";

Newsgroups: comp.lang.c++
From: tel@adimail.uucp (Terry Monks)
Subject: More Gnu C++ fun
Organization: Automata Design, Inc.
X-Newsreader: TIN [version 1.1 PL7]
Date: Wed, 30 Dec 1992 19:57:14 GMT

This minimal program


class node 
{
public:
  static int level;
  
  node(){};
};

main()
{
  node::level=1;
}


compiles and links fine using the AT&T compiler from Sun, but will not link
under Gnu c++.  (sparc-sun-sunos.4.1)

I get the message
ld: Undefined symbol
   __4node$level


Any clues?

-- 
Terry Monks        Automata Design Inc    (703) 742-9400

Newsgroups: comp.lang.c++
From: dschieb@muse.cv.nrao.edu (Darrell Schiebel)
Subject: Re: template disappointments ... (suggestions?)
Organization: National Radio Astronomy Observatory
Distribution: comp
Date: Tue, 29 Dec 1992 19:42:47 GMT

From troym@zeppelin.convex.com Tue Dec 29 14:26:34 1992
Date: Tue, 29 Dec 92 13:26:39 -0600
From: troym@zeppelin.convex.com (Troy D. Miller)
In article <DSCHIEB.92Dec29133556@muse.cv.nrao.edu> you write:
>>
>>		list<vector<int>> list_vec_int;
>                       ~~
>		A space is required.  Right Shift operator >> is taken.
>
>		list<vector<int> > list_vec_int;


	That was the problem ... indeed a space is required. This seems like
	a curious constraint! Ah well, thanks for the help!!!

							Darrell Schiebel
Newsgroups: comp.lang.c++
From: awilson@nyx.cs.du.edu (Andy Wilson)
Subject: Need help with color-cycling, direct memory graphics read/write
Summary: Slightly !clue and trying to hack this out.
X-Disclaimer: Nyx is a public access Unix system run by the University
	of Denver for the Denver community.  The University has neither
	control over nor responsibility for the opinions of users.
Keywords: VGA cycling DAC color cycle help
Organization: Nyx, Public Access Unix at U. of Denver Math/CS dept.
Date: Sat, 26 Dec 92 03:17:56 GMT

   Greetings, world! I'm working on some graphics stuff in Turbo C++ 3.0,
and am trying to figure out how to color-cycle the VGA palette in the 
standard 320x200x256 mode. (For argument's sake, color-cycling is the
trick Fractint does, especially on the plasma type.) The only problem
is that I am extremely !clue on how to do this. Would some wise soul
please either explain (in newbie terms--I'd rather feel stupid than 
remain lost) [:)] how to do this or point me at some sourcecode that's
easily comprehensible? Thanks very much! (In advance, even.)

#include <gratitude.h>
awilson@nyx.cs.du.edu



Newsgroups: comp.lang.c++
From: rmartin@thor.Rational.COM (Bob Martin)
Subject: Re: .. ptr_cast ..
Keywords: ptr_cast
Organization: Rational
Date: Tue, 22 Dec 1992 18:02:49 GMT

koelma@fwi.uva.nl (Dennis Koelma) writes:

|Hi,

|Does anybody know whether the function "ptr_cast", page 442 in
|"The C++ programming language" by Stroustrup, is or will be supported
|by the Sun compiler ?

This proposal has undergone a few changes.  the ptr_cast syntax has
been replaced with regular cast syntax.  I am not certain of the
status of this proposal with the standards committee.

|If not, is there some "workaround" library available ?

It is not very hard to implement your own RTTI system, although it is
a bit tedious and prone to error.  You might want to look at the
scheme used by the NIH classes, just for educating yourself on one
kind of method.

The trick to any kind of RTTI is to be able to answer the following
question:  Is object X derived from class Y.  The answer of this
question must be TRUE if X is an instance of Y, or an instance of any
class derived from Y.  (Consider the complexities that this implies
for MI).

In general, to be able to answer this question, you must have some
kind of ID which is unique for every different class.  Then a virtual
function which all objects posess which asks the question.  When the
function executes, it checks the ID of the object with the ID in the
query.  If they match, it returns TRUE, otherwise it returns the
result gotten by calling the same function in each of the base
classes.  At the top of the inheritance hierarchy there is a class
which all other classes must derive from.  Call it "Object".  This
class declares the virtual query function and creates an
implementation which returns FALSE.

You can work out the rest of the details for yourself, it is not real
hard.  

However, it should be noted that implementing such schemes places a
burden upon your class hierarchy.  Every class must have the ID, every
class must implement your query function, etc, etc.  Third party
classes cannot directly participate, someone must be in charge of
dispensing unique ID codes to prevent the possibility of overlap, etc,
etc...

If you get the idea that I don't like to see schemes like this, you
are right.  If at all possible, I would wait for the compiler vendors
to implement the RTTI proposal.

Once you have RTTI, the temptation is to use it all the time.  Taken
to its extreme, this will cause you to undo many of the benefits of
OO. You should be very jealous of the secrecy of the type of an
object.  It should be exposed only in the most extraordinary of
circumstances.  There are certainly cases where RTTI is useful, but is
is also very easy to abuse.



--
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++
Newsgroups: comp.lang.c++
From: ort@netcom.com (David Oertel)
Subject: Re: IS C++ a language for the "average programmer"
Summary: Re: Is C++ a language for the "leverage programmer"
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Thu, 24 Dec 1992 06:17:11 GMT



From: val@news.ccutah.edu (Val Kartchner) writes:

>The simple mathematical operations that we take for granted are simply
>derivations of the 13 assumptions.  Algebra is an extension of those.
>Calculus and geometry are an extensions of algebra.  The advantage of one
>method over another is that you have different conceptual levels and
>notational syntaxes (and symboligies) which represent them.

>Object-orientedness doesn't allow you to solve problems that couldn't be
>solved otherwise.  It does, however, allow a different way of addressing
>the problems that you are given to solve.

	I can corroborate this idea with regard to calculus.  Newton used to 
	solve problems using calculus and then publish his solutions using 
	algebra.  He didn't reveal calculus until the end of his life when he
	was under competitive pressure from Leibniz.  I don't think that
	anyone know for sure why he delayed, but he was extremely eccentric.

	Dave Oertel
	ort@netcom.com
-- 
Newsgroups: comp.lang.c++
From: johnh@tt.com (John Hasselkus)
Subject: Template member functions?
Organization: Telecommunications Techniques Corporation, Germantown MD
Date: Mon, 21 Dec 1992 16:11:24 GMT

I though I recall this being discussed recently, but I didn't need to know
until now. :)

Is is possible to make a template member function of a class that is not a
template class?

For example:

class FOO {
  public:
    void bar (A a);     <- I would like (instead) to make bar be a template
    void bar (B b);        function so that I don't have to recode the
    void bar (C c);        algorithm used for "bar" 3 times.
}

-- 
John Hasselkus
johnh@tt.com
Newsgroups: comp.lang.c++
From: ghica@fig.citib.com (Renato Ghica)
Subject: BORLAND C++ ; new int(1,000,000)
Originator: ghica@duck
Organization: Citibank IBISM
Date: Wed, 30 Dec 1992 01:56:06 GMT



Is it possible to allocate more than 640K (from extended or
expanded memory) on a DOS 5.0 system using a borland 3.1 C++ program?

Using the huge memory model, I'm trying to do the equivalent
of 
	new int(1,000,000);  

	without commas, of course.
I have not successed. (I know I can allocate 64k+ at the time).

Do I need to use a virtual memory machine?

Is this an FAQ? If it is, pardon the ignorance.


thanks to any reply.
-- 

"You're a cold one, Mr. GRINCH! Your head is full of
spiders nd your teeth are made of wood!"
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c++
Subject: Re:  Give me safe C++
Date: 22 Dec 92 02:56:39 GMT
Article-I.D.: alice.24462
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Murray Hill NJ

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

> 	What would you have your brakes do if the run-time
> checks detected a program error?

My car has some characteristics that appear to be designed to
forestall just that kind of problem.  For example, if the
speed exceeds 40 km/h and the steering angle sensor shows
more than 35 degree steering angle for more than 80 seconds,
a separate circuit assumes that the sensor is broken and
turns off the variable ratio steering.
-- 
				--Andrew Koenig
				  ark@europa.att.com
From: lupe@ukw.uucp (Lupe Christoph)
Newsgroups: comp.lang.c++
Subject: Re: More Gnu C++ fun
Date: 2 Jan 93 17:57:53 GMT
Organization: cic

tel@adimail.uucp (Terry Monks) writes:

>This minimal program


>class node 
>{
>public:
>  static int level;
>  
>  node(){};
>};

>main()
>{
>  node::level=1;
>}


>compiles and links fine using the AT&T compiler from Sun, but will not link
>under Gnu c++.  (sparc-sun-sunos.4.1)

>I get the message
>ld: Undefined symbol
>   __4node$level


>Any clues?

Here is what I get from SunPro's C++ 3.0.1:

alanya:~/tmp 2-> cat > x.cc
class node 
{
public:
  static int level;
  
  node(){};
};
 
main()
{
  node::level=1;
}
alanya:~/tmp 3-> CC -o x x.cc
ld: Undefined symbol 
   node::level -- static member node::level should be defined in the program ,see Language Reference Manual Section 9.4
 
Compilation failed
Exit 2

I like the pointer about the "Language Reference Manual". Bad thing
about is that the right chapter is 9.5! :-)
-- 
| ...!unido!ukw!lupe  (German EUNet, "bang")     |  Disclaimer:            |
| lupe@ukw.UUCP       (German EUNet, domain)     |  This is an unofficial  |
| suninfo!alanya!lupe (Sun Germany)              |  opinion of Christoph & |
| Res non sunt complicanda praeter necessitatem. |  Imschweiler Consulting |
Newsgroups: comp.lang.c++
From: jyc@hcla.com (Joy Chhugani)
Subject: new and delete in MFC and BorlandC
Organization: HCL America, Inc.,
Date: Wed, 23 Dec 1992 23:03:59 GMT



I am using Microsoft's MFC with Borland's C++ 3.1 IDE.

This is a rough sketch of a class that I have -

class Foo
{
private:
	CPoint		*pts;
    ...

public:
	Foo(const CPoint	init[], short	num);

	virtual
	~Foo(void)
	{
    	delete [] pts;			// <-------------   ::operator delete
	}
	...
    ...
};

Foo::Foo(const CPoint	init[], short	num)
{
	if (pts = new CPoint[num])  // <-------------   _vector_new 
	{
		for (short i = 0; i < num ; i++)
        	pts[i] = init[i];
    }	
}

The problem is that MFC's overloaded global operators new and delete
are incompatible with BorlandC's internal memory allocation functions.

In the Foo constructor the pts member points to an array allocated by
"_vector_new" which is presumably an internal BorlandC function.

In the destructor surprisingly the MFC overloaded global operator delete
functions gets called. This does some memory usage check which fails.

Has anybody encountered this problem or am I doing something that is
wrong ? Any workarounds, solutions, suggestions etc. are welcome.

Thanks in advance for the replies.


--
Joy Chhugani
jyc@hcla.com
uunet!hcla!jyc
From: bruceb@roadrunner.denver.sgi.com (Bruce Bailey)
Newsgroups: comp.lang.c++
Subject: Re: >>>>>>>>  Is it possible to use 'delete this' ?
Date: 31 Dec 92 19:57:05 GMT
Organization: Silicon Graphics, Inc.

In article <796@ulogic.UUCP>, hartman@ulogic.UUCP (Richard M. Hartman)
writes:
|> 
|> Is it possible, within the definition of a class, to ensure that
|> the object may only be successfully created by "new" and not
|> by a simple declaration?
|> 
|> e.g.
|> 
|> 	Object *p = new Object;		// ok
|> 	Object O;					// fails
|> 
|> 
|> It would be nice if we could make a constructor such that
|> the second declaration gets flagged as an error, but out
|> of curiosity -- even if that is not possible is it possible
|> to create a class that at least generates a run time error
|> if you try to create one non-dymically?
|> 

I think that if you make the destructor private, the compiler will give
you an error when the object goes out of scope, e.g., when you leave the
function that the declaration is in...

Bruce Bailey (bruceb@denver.sgi.com)
Newsgroups: comp.lang.c++
From: dschieb@muse.cv.nrao.edu (Darrell Schiebel)
Subject: Re: template disappointments ... (suggesti
Organization: National Radio Astronomy Observatory
Date: Wed, 30 Dec 1992 18:29:21 GMT

In article <1992Dec30.161136.24591@nrao.edu> cflatter@nrao.edu (Chris Flatters) writes:
>
>Newsgroups: comp.lang.c++
>Path: cv3.cv.nrao.edu!laphroaig!cflatter
>From: cflatter@nrao.edu (Chris Flatters)
>Sender: news@nrao.edu
>Reply-To: cflatter@nrao.edu
>Organization: NRAO
>References: <1hqnd6INNe83@agate.berkeley.edu>
>Date: Wed, 30 Dec 1992 16:11:36 GMT
>Lines: 26
>
>In article 1hqnd6INNe83@agate.berkeley.edu, jbuck@foucault.berkeley.edu (Joe Buck) writes:
>>In article <24508@alice.att.com> ark@alice.UUCP () writes:
>>>In article <DSCHIEB.92Dec29133556@muse.cv.nrao.edu> dschieb@muse.cv.nrao.edu (Darrell Schiebel) writes:
>>>> 		list<vector<int>> list_vec_int;
>>>
>>>Huh?? This works fine -- just remember to put a space between the
>>>two > characters so the >> won't be taken for a shift-right symbol.
>>
>>This is such a common error (and is so ugly) that compiler writers
>>would be well advised to add productions to their grammar that catch
>>it, or magic that splits the >> token into two tokens in this case
>>if that fits in with the compiler's structure.
>>
>>Yes, I know that the rules of lexical analysis force the >> to be one
>>token, but list<vector<int>> is a perfectly natural way of writing
>>this thing, so perhaps it should be permitted even at the cost of
>>adding an ugly rule to the grammar.
>
>It requires more than a modification to the grammar (unless you find it
>acceptable to allow arbitrary amounts of whitespace in the middle of
>a right-shift operator).  You would have to switch lexical analysers
>while parsing a template declaration or a template class name and switch
>back afterwards.

This is a bit of an exaggeration. I believe that the true semantics of 
nested ">"s could be determined totally based on left context. Perhaps
a right-shift operator type template argument could cause a problem, but
if left context were available, I think this could be resolved also.
However, one does not often have the advantage of the entire left context.


							Darrell Schiebel
Newsgroups: comp.lang.c++
From: erc@netcom.com (Eric Smith)
Subject: Re: Newbie Wants Advice on C-Programming
Organization: Netcom - Online Communication Services (408 241-9760 guest)
Date: Fri, 25 Dec 1992 08:42:29 GMT

In article <1992Dec25.071510.19584@netcom.com> ort@netcom.com (David Oertel) writes:
>Could someone elaborate on why Smalltalk is not a good development language if
>this is not too FAQy?  I've been successfully developing products through rapid
>iterative prototyping without any up-front design.  I've gotten good results
>by throwing prototypes at the customer and letting him free associate to 
>determine future direction.  Maybe Smalltalk would support this M.O. better
>than C++, because I'm spending a lot of time compiling.  Maybe hardware is
>getting fast enough to compensate for interpretation, garbage collection, and
>slow method resolution.


In a subtle way, you contradict yourself.  You say "maybe hardware is
getting fast enough ..." but you also say "... I'm spending a lot of
time compiling."

You don't mean YOU are spending a lot of time compiling, you mean your
HARDWARE is spending a lot of time compiling.  Therefore, hardware is
not getting fast enough to compensate for anything, because it's not
even fast enough yet to do a normal compile without an annoying delay.
There are a lot of programs with the same problem, but a compiler is
a good example because it's one program most programmers have used
extensively.

People often say hardware technology has advanced so much software
technology is left far behind, and that it will take years just to
develop applications that can really take advantage of present day
hardware.  But that's really nonsense.  It will take years to develop
hardware advanced enough to really work well with present day software.

Will hardware technology ever catch up with C++, and pass it to become
a better match for Smalltalk?  Not likely, because by that time, you
will be able to do rapid prototyping in C++ just as fast as in Smalltalk.
Rapid prototyping depends on the programming environment more than on
the language.  There are already some C++ development environments
evolving towards the goal of rapid prototyping, and they are available
now from companies such as ParcPlace, Centerline, Lucid, etc.
From: roger@genie.UUCP (Roger H. Scott)
Newsgroups: comp.lang.c++
Subject: Re: "type safety" deemed essential
Date: 20 Dec 92 17:49:42 GMT
Reply-To: roger@genie.UUCP (Roger H. Scott)
Organization: proCASE Corporation, Santa Clara, CA

In article <rmartin.724430168@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
>kocks@leland.Stanford.EDU (Peter Kocks) writes:
>
>>My $0.02.  Use Obj-C.  I have just spent a fair amount of time
>>comparing strong vs weak type casting systems [...]
>
>For any significant industrial application, I think strong typing is
>utterly essential.  It is just too easy to create horrible run time
>errors without type safety.  

This sounds like theory rather than practice speaking.  Let's hear from the
(net) C++ user community: who has written a non-trivial commercial C++ 
application *without* making significant use of either type casting [(T *)]
or run-time type checking [Bar *bar_p = foo_p->asBar();]?  I maintain that
C++ makes it *very* difficult to do without at least one or the other of these
(Eiffel-style "anchored" virtual function return types would go a long way to
alleviate this).  I'm hoping that templates will help in this regard, but they
haven't been available long enough to judge.
Newsgroups: comp.lang.c++
From: valentm@ghost.dsi.unimi.it (marco valentini)
Subject: prototyping object?
Organization: Computer Science Dep. - Milan University
Date: Tue, 22 Dec 1992 11:45:24 GMT
Summary: I need a prototyping for object


I have written the following code:
class paolo;  //!Is Right this ??????
object pippo
{
  paolo* p;
  public:
   void ....
   ..... (various methods)

}
object paolo
{
  pippo* pi;
  public:
   int ...
   ...(variuos methods)
}

then I have do pippoobj=new pippo
	       paoloobj=new paolo
then the constructor of two object assign the value of pippoobj->pi=paoloobj
paoloobj->p=pippoobj
but when I access to the pippo's methods via pi the compiler tell me that
pippo obj don't have this methods.
where is my error (I think in prototiping the class paolo with class paolo;)

			Thanks to anyone want help me.


				Valentini Marco
				Dip. Scienze Informazione
				Univ. Milano (IT)

				Mail at valentm@pippo.sm.dsi.unimi.it
From: bs@alice.att.com (Bjarne Stroustrup)
Newsgroups: comp.lang.c++
Subject: Re: where the name C++ came from
Date: 26 Dec 92 14:00:46 GMT
Article-I.D.: alice.24484
Organization: AT&T Bell Laboratories, Murray Hill NJ



dak@messua.informatik.rwth-aachen.de (David Kastrup @ Rechnerbetrieb Informatik - RWTH Aachen) writes

 > tostan@dumbo.lerc.nasa.gov (Stan Mohler) writes:
 > 
 > >Hi-
 > >I had a dream last night in which I figured out a possible reason for C++
 > >having the name C++.  Yesterday I was reading about C and C++.  I skimmed
 > >across a few lines showing the use of operators such as ++.  i++ measns to
 > >increment variable i.  Incrementing something means to increase it, expand it
 > >if you will.  Is it possible that "C++" simply means an "expanded C" in the
 > >most economical and cute way a C programmer might think of?
 > 
 > Ingenious! ...

 > Final thought: C++ does increase the value of C, but the increased value
 > is not used. Maybe ++C would have been the better choice... :)

See The C++ programming Language (either edition) page 4 for the details.
Newsgroups: comp.lang.c++
From: michi@ptcburp.ptcbu.oz.au (Michael Henning)
Subject: Re: Is it possible to use 'delete this' ?
Organization: Pyramid Technology Corporation
Date: Wed, 23 Dec 1992 23:58:09 GMT

robertd@kauri.vuw.ac.nz (Robert Davies) writes:

>rmartin@thor.Rational.COM (Bob Martin) writes:
>>bernd@bwhwob.escape.de (Bernd Wiegmann) writes:
>>
>>>Hi,
>>
>>>Is it possible to use 'delete this' as the last statement in a
>>>method of a class ?
>>
>>In general, "delete this" is a bad idea.
>> .........

>This is the standard argument - but I suspect it is not necessarily the 
>correct one.

>I agree that "delete this" could be very confusing in a function likely to
>be used by others (or oneself, sometime in the future), but for a function
>that is only for internal use by one's package, probably declared private 
>and properly documented, there doesn't seem to be a problem.

>The danger with the statements that "delete this" is not a good idea is 
>that the compiler writers or standards committee will listen and a very
>useful construct (in some situations) will be lost.


There is already precedence for delete(this), in the C++ task library.
Since Bjarne was involved in writing the code for this one, I would
expect the standard to sanction it :-)

The reference manual, section 5.3.4, says nothing to prohibit it.

								Michi.

-- 
      -m------- Michael Henning                 +61 75 950255
    ---mmm----- Pyramid Technology              +61 75 722475 FAX
  -----mmmmm--- Research Park, Bond University  michi@ptcburp.ptcbu.oz.au
-------mmmmmmm- Gold Coast, Q 4229, AUSTRALIA   uunet!munnari!ptcburp.oz!michi
Newsgroups: comp.lang.c++
From: simon@mierzyn.cs.odu.edu (Michael N Simon)
Subject: pcx, gif, bmp, tiff
Organization: Old Dominion University, Norfolk, VA, USA
Distribution: comp
Date: Thu, 31 Dec 1992 06:02:29 GMT


I'm looking for a program written in borland c++ 2.0 or greater that will
be able to take a scanned image in one of the above formats and be able to display it on the screen for me.  I would like to use it for an introductory screen to a program that I wrote....


Happy New year and thanks for your help...

mike

simon@cs.odu.edu