HDTenEightyP/NetNews huggingface dataset:
From: gordie@duts.ccc.amdahl.com (Gordon Freedman)
Newsgroups: comp.lang.c++
Subject: Re: C++ member pointer error
Date: 29 Jul 92 18:07:13 GMT
Reply-To: gordie@duts.ccc.amdahl.com
Organization: Happy hacker bait and tackle shop

Please ignore my previous response to this post, like Lucy and Linus you will 
just have to unlearn what I said (I will research before I post I will research
before I post I will research before I post ...)

---
Gordon Freedman: gjf00@duts.ccc.amdahl.com OOPs, did I code that?
From: raymond@cucs11.cs.cuhk.hk (Ho Wai Ming (Raymond))
Newsgroups: comp.lang.c++
Subject: Help : Install GNU C on Motorola SysV68  V3R6
Summary: I have a problem when installing the GNU C and C++ compiler on
Date: 29 Jul 92 08:15:00 GMT
Organization: Faculty of Engineering, The Chinese U. of Hong Kong

I have a problem when installing the GNU C and C++ compiler on my
system.  My system is running on Motorola's delta 3300 series machone with
o.s. system V version V3R6.  When the gcc compiler compiles the library
'libgcc2.c', it got fatal signal with the following routines :-

floatdidf, floatdisf, .....   I think it is due the 'cast' conversion.

Can anyone tell me what is SGS assembler?  It is defined in the include file.
Newsgroups: comp.lang.c++
From: eric@tfs.com (Eric Smith)
Subject: Re: Renew?
Organization: TFS
Date: Sat, 25 Jul 1992 22:47:12 GMT

In article <23315@alice.att.com> ark@alice.UUCP () writes:
[discussion of copy constructor vs move constructor for realloc]
>If I write a copy constructor in my class, I expect that constructor
>to be called when an object of that class is copied.  Period.

Reallocation does not involve copying, it involves moving, which can
take a lot less time than copying, because it can avoid an extra
construction and destruction.  The amount of time that can be saved is
limited only by the slowness of the constructor and destructor, which
for some classes can be quite significant.

IMHO a move constructor would be very useful, not only for reallocation,
but also for various types of container editing, such as inserting some
new objects in the middle of an array, which would require moving the
old objects aside to make space for the new ones.

A move constructor conceptually achieves the same purpose as the
combination of a copy constructor plus a destructor, except that the
move constructor is free to take advantage of the fact that the old
object is no longer needed.  Thus for example if the old object contains
some pointers to live data, the move constructor can just move those
pointers without bothering the live data at all.
Newsgroups: comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: NaN - magic value
Organization: TauMetric Corporation
Date: Wed, 29 Jul 1992 17:22:52 GMT

ger@cv.ruu.nl (Ger Timmens) writes:


>I want to assign a magic value to certain double variables;
>Currently I return DBL_MAX, as defined in <float.h>.

>Is it possible to assign the value NaN, to double variables ?
>(NaN = NotANumber, e.g. dDouble = 1.0 / 0.0 ==> dDouble == NaN)

It depends entirely on the implementation of floating-point on your
system.  Implementations are not required to supply NaN as a value
or result, and if they do, they are allowed to generate a signal
which you would have to catch.

Check the documentation for your system to see whether it uses NaN's,
and how to use them.  I suggest you isolate any code using NaN to
one module, since the code will not be portable.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Casting Away Const
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Wed, 29 Jul 1992 23:09:18 GMT

Casting away const is a dangerous but necessary practice when
for example, caching is considered.

How about if casting away const could only be done by members
with private access?

In particular, public clients are prohibited from casting away
const?


-- 
;----------------------------------------------------------------------
        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: rittle@supra.comm.mot.com (Loren James Rittle)
Subject: Use of constructor within class declaration
Organization: Land Mobile Products Sector, Motorola Inc.
Date: Fri, 24 Jul 1992 23:29:26 GMT

Hello net friends,

Can anyone explain what is happening below?  Why can I not use a class'
constructor as a default argument in a function defined in a class?  Is
there a good way around this problem (other than moving the function
definition out of the class OR using overloading)?  Does any version of
AT&T C++ fix this problem (I can find no reference in the 'BS' C++
manual about this.  I'm just learning C++ so I may have missed something)?

A person I work with claims that even if I could use a constructor as I
wish, it would be bad style.  What is your opinion?  To me it is as
natural to want to use a constructor anywhere in the class  declaration
after it is declared as it is to refer to a class' members later within
the class declaration.

The example has been kept short in the hopes that someone will take the
time to respond.  Thanks for email or posted responses that can be
summerized upon demand.

Regards,
Loren

$ gcc test2.C  # gcc 2.2.2
test2.C:7: type `point' is not yet defined
$ cxx test2.C  # DEC cxx 2.1
test2.C:7: error: In this declaration, "point" is an incomplete or
function type and so cannot be the target type of a conversion.
Compilation terminated with errors.

- --- begin test2.C ---
class point
{
  double _x, _y;
public:
  point (double x = 0.0, double y = 0.0) : _x(x), _y(y) {}
#if 1
  double distance (point o = point (0.0, 0.0)) { return /* ... */ 0.0; }
#else
  double distance (point o) { return /* ... */ 0.0; }
  double distance (void) { return /* ... */ 0.0; }
#endif
};
- --- end test2.C ---
Newsgroups: comp.lang.c++
From: gs4t@virginia.edu (Gnanasekaran Swaminathan)
Subject: Re: _new_handler????
Reply-To: gs4t@virginia.edu (Gnanasekaran Swaminathan)
Organization: University of Virginia
Date: Wed, 29 Jul 1992 23:24:40 GMT

losaccom@cs.rpi.edu (Mark LoSacco) writes:
| 
|    I was hoping someone here might be able to help me out.
| I am using the latest g++ compiler, and am trying to set the
| supposed system variable "_new_handler" to point to a function
| that will be called whenever an out-of-memory error occurs.
| 
|    I say supposed because when I try to compile it, I get the
| message: Undefined symbol __new_handler referenced from text
| segment.  

The variable name is __new_handler in g++ not _new_handler.
An extern declaration of the variable can be found in the
include file new.h

In any case, please use set_new_handler( void(*)() )
to change the default behavior as described in ARM p.280-281

For example,
	#include <new.h>

	void  newh () { cout << "new handler\n"; ... }

	void (*oldh)() = set_new_handler(newh);

-Sekar
Newsgroups: comp.lang.c++
From: mat@mole-end
Subject: Re: Novice? question: Designing for multiple inheritance w/ templates
Organization: :
Date: Tue, 21 Jul 1992 13:10:54 GMT

In article <1992Jul20.152931.8037@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
> In article <1992Jul19.233851.15525@mole-end> mat@mole-end writes:
> 
> >...  From what I can tell, virtual inheritance is principally useful
> >for importing what might be called `object representation behavior,'
> >e.g. printability, special allocation and deallocation, etc.--things
> >that are related to the representation OF the object, rather than to
> >what the object itself represents.

> 	Quite the opposite I find. Its prinicple use is in 
> deriving new abstractions from old. 
> 	A golden rule is : ALL ABSTRACT BASES SHOULD BE INHERITED
> PUBLIC VIRTUAL.
> 	IMHO almost every public derivation ought to be virtual.
> Public virtual derivation with abstract classes is used to
> make a multi-faceted abstraction.
> 	Because the derivation is virtual, you can hook in implementations
> of the various abstractions of combinations of them at the last minute:
> late binding of implementation details.  These details [should] usually
> be bound in to a class with local scope (or file scope) ... guaranteeing
> all access is dependent on the abstract properties of the object only.
> 	This mechanism ... and guarrantees the run-time type of the object
> can ONLY be be accessed via declared virtual functions.
  ...
> 	A new optimisation technique (like caching) can be
> hooked in, on an object by object basis, at construction time.

This is exactly what I was saying.  The thing added by Virtual MI is added
not for the sake of what the class represents, but for the sake of the
class representation.  It doesn't represent something in the problem
domain and won't appear on an object-occurrence or class-relationship
diagram.  Instead it provides something that belongs to the solution domain,
to the properties of the programmatic object rather than the analysis
object.

Or do I misunderstand you completely?
-- 
 (This man's opinions are his own.)
 From mole-end				Mark Terribile

 uunet!mole-end!mat, Somewhere in Matawan, NJ
From: heinz@edohwg.UUCP (Heinz Wrobel)
Newsgroups: comp.lang.c++
Subject: Re:  strdup() Was: Re: Renew?
Date: 29 Jul 92 21:33:36 GMT
Organization: Edotronik GmbH

In article <1548ujINN826@agate.berkeley.edu> jbuck@forney.berkeley.edu (Joe Buck) writes:
>>Since strdup is a very tiny function, your best bet is to write one
>>yourself for use with C++, using new rather than malloc if you wish.
>
>Like so:
>
>#include <string.h>
>
>char * strdup_new (const char * input) {
>	return strcpy(new char*[strlen(input)+1],input);
>}

Where is the error check for not having enough memory, i.e. new giving back
a NULL pointer? Don't you need an error check?

>Joe Buck	jbuck@ohm.berkeley.edu

--
Heinz Wrobel, Edotronik GmbH (ECG018)
FAX +49 89 850 51 25 / TEL +49 89 850 25 20 (HOME!&VOICE, sometimes...)
From: mbrinn@bbn.com (Marshall Brinn)
Newsgroups: comp.lang.c++
Subject: C++ 3.0 for Sun 4/600
Date: 22 Jul 1992 13:49:23 GMT
NNTP-Posting-Host: bbn.com

Does anyone have suggestions or thoughts about available C++ compilers for 
a SUN 4/600 for language level 3.0 or higher?

Thanks.

Marshall Brinn
-------------------
mbrinn@bbn.com
BBN Systems and Technologies
From: davidm@consilium.com (David S. Masterson)
Newsgroups: comp.lang.c++
Subject: Re: CLASS Libraries for SALE ???
Date: 26 Jul 92 20:37:12 GMT
Distribution: comp
Organization: Consilium Inc., Mountain View, California
In-reply-to: narayan@aravali.everest.tandem.com's message of 24 Jul 92 22:48:32 GMT
X-Posting-Software: GNUS 3.13  [ NNTP-based News Reader for GNU Emacs ]

>>>>> On 24 Jul 92 22:48:32 GMT, narayan@aravali.everest.tandem.com (Pankaj
>>>>> Narayan) said:

> Is there a place I can get either public-domain class libraries or else for
> a small charge ? I'd like to get as extensive a set as possible, to see what
> I can use.

At one time, I remember seeing advertisements here for the AMIX BBS
(415-856-1234) for just this purpose.  Has anyone given it a try?
--
====================================================================
David Masterson					Consilium, Inc.
(415) 691-6311					640 Clyde Ct.
davidm@consilium.com				Mtn. View, CA  94043
====================================================================
"Read My Lips: No Nude Texans!" - George Bush clearing up a misunderstanding
Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: const on pass by value
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Thu, 30 Jul 1992 16:45:37 GMT

In article <1992Jul28.180713.16258@mole-end.matawan.nj.us> mat@mole-end.matawan.nj.us writes:
>In article <9220801.5026@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
>> mat@uunet.uu.net!mole-end writes:
>> 
>> >In article <1992Jul24.151010.11969@PacBell.COM>, pjcondi@lepton (Paul Condie) writes:
>> >> Should pass by value arguments be declared as "const" for
>> >> good coding style?  Or is that nit picking?
>
>> >> void foo (const int a);
>> >> or
>> >> void foo (int a);
>> >
>> >It's not nitpicking.  It's part of something called const correctness.
>> >Your program has it or doesn't.  Programs that have it are almost immune
>> >to a certain large family of errors.
> 
>> Huh? In this example, it IS just nitpicking.  How could the presence or
>> absence of const in the declaration for foo affect the program's const
>> correctness?
>
>It affects what version of overloads are applied to the variable/object
>and the confidence of the reader that the variables are/are not changed.
>

	I do not believe you are correct. The above declarations cannot
be distinguished for overloading purposes. (Except, incorrectly perhaps,
in my compilers template matching algorithm).

	The const serves no function in the decaration, only
in the definition (Unless silently converting to a const reference
is allowed). That the const must be placed in the declaration to
have it active in the defintion is a design flaw in the language.
It is luckily relatively harmless. It forces the interface designer
to decide whether the function implementation will need to
modify the object or not.

	The safest default is therefore NOT to declare pass by value
const, unless it is known in advance that the copy of the object
will not be modified.



>-- 
> (This man's opinions are his own.)
> From mole-end				Mark Terribile
>
> mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
Xref: sparky comp.lang.c++:11656 comp.lang.eiffel:997
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c++
Subject: Re: Renew?
Date: 26 Jul 92 02:29:52 GMT
Article-I.D.: alice.23316
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Liberty Corner NJ

In article <1992Jul25.151227.8156@hemlock.cray.com> de@cray.com (Duane Eitzen) writes:

> To restate the problem: if your C++ is actually just a C++ to C translator,
> you can't use realloc() in your implementation of renew.

> This is true. Two ways around this: one is to implement your own
> memory management (difficult, as you say). The other is to take
> advantage of the fact that renew can do the move every time and still
> adhere to the specification (although not providing the implied
> performance gains). With this approach, renew can be implemented with
> only malloc().

Yes indeed.

> So in the worst case, renew would just be short hand for a new, a bunch
> of copies and a delete. With a good compiler and a little luck, it
> could provide significant performance gains. This is all that realloc()
> claims to be now. And I like realloc.

Yes again.

Incidentally, I pointed out in an article a while ago that virtually the
same effect could be obtained with an appropriate template function
in the run-time library:

	template <class T> T* renew (T*, size_t);

So one interesting question is whether any changes to the language are
actually necessary at all.

The main disadvantage of a library function is that I don't see how to
duplicate the effect of placement arguments in new-expressions.  That is,
I can say

	new(super_duper_fast_memory()) T;

where super_duper_fast_memory represents a function that might, for
example, allocate a block of appropriate memory and return a pointer to it.
I don't see quite how to reconcile this with a renew library function,
and it's not clear whether this is even important.

> On the topic of submitting a proposal: how does one do this? How
> much time should one expect to spend doing it? What percentage of
> external proposals are successful?

Read the recent (a few months ago) Sigplan article about how to propose
a language extension.  If you can't get your hands on it, send me email
and I'll make sure you get a copy.
-- 
				--Andrew Koenig
				  ark@europa.att.com
Newsgroups: comp.lang.c++
From: staal@idt.unit.no (Staal Amund Vinterbo)
Subject: Documentation tools.
Reply-To: staal@idt.unit.no (Staal Amund Vinterbo)
Organization: Div. of CS & Telematics, Norwegian Institute of Technology
Date: Wed, 22 Jul 92 17:46:06 GMT

Are there any tools publicly available that help documenting 
C++ code? What I am looking for is something that reads C++ code
and generates templates for documentation, class hierarchies, etc. 
Thank you in advance.
-Staal-

-- 
////   Staal Vinterbo, Norwegian institute of Technology ////
///    E-mail: staal@idt.unit.no                         ///
//             staal@solan.unit.no                       //
/      tlf: 07-520092                                    /
Xref: sparky comp.lang.c++:11812 comp.windows.ms:18115
From: shyam007@ccwf.cc.utexas.edu (Shyam sundar P Cherlopalle)
Newsgroups: comp.lang.c++,comp.windows.ms
Subject: BC 3.1 PStream error-- Help required
Date: 30 Jul 92 20:37:11 GMT
Reply-To: shyam007@ccwf.cc.utexas.edu (Shyam sundar P Cherlopalle)
Followup-To: comp.lang.c++
Organization: The University of Texas at Austin, Austin TX
Originator: shyam007@tramp.cc.utexas.edu





  I have been trying to use the TStreamable class of Borland's ObjectWindows
  and write the stream to a file. The class is derived multiply from
  TNSCollection and TStreamable classes. As required by decendents of 
  TStreamable I defined the four operator overloading functions, read, 
  write, build etc and registered the class using 


	TStreamableClass RegClassname(....);

  But when I tried to write an instance of the above class to a file I have
  been getting an error saying

     PSTREAM ERROR CONDITION -- Type not Registered.

  The class I defined is very similar to the class TPointArray in the steps
  example of ObjectWindows. Can somebody help me get around this by suggesting
  probable error I might have committed.

  I have been working on this problem for a week now and have been unable to
  hack around it. It would also be very helpful if some kind soul could send
  me some source code which shows the usage of the above.

  Thanks in advance,

  -- Shyam
----------------------------------------------------------------------------
Shyam Cherlopalle                              University of Texas at Austin
email : shyam007@ccwf.cc.utexas.edu        
----------------------------------------------------------------------------
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c++
Subject: Re: const on pass by value
Date: 25 Jul 92 14:51:06 GMT
Article-I.D.: alice.23312
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Liberty Corner NJ

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

> I think the following should be legal:

> void foo (int a);
> void foo (const int a) { .... } // SAME as foo above

It is much easier to describe and understand the language if any difference
at all in argument types means that the functions are different.  That ideal
is not quite possible because C mandates an array/pointer equivalence,
but I think complicating that rule further should require some corresponding
benefit.
-- 
				--Andrew Koenig
				  ark@europa.att.com
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.c++
Subject: Re: Determining object type at runtime ?
Date: 31 Jul 92 04:34:37 GMT
Organization: NetLabs, Inc.

In article <Bs43r6.C24@ibg1.ibg.sub.org> ado@ibg1.ibg.sub.org (Christoph Adomeit) writes:
: Hi C++ freaks,
: 
: I need an idea about how to solve the following problem:
: I embedded some C++ classes into an interpreter (perl).
: Perl only understands C-calls, so I wrapped some functions
: like
: 
: extern "C"
: {
:   void *new_myobject(constructor vars)
:   { return (void*)new myobject(constructor vars); }
: 
: 	int myobject_print(void *myobj)
: 	{ 
: 		myobject *object=(myobject*)myobj;
: 		return object->print;
: 	}
: }
: 	...

You shouldn't need to go to all that trouble.  If your init routine
that's called from userinit() is called, say, init_foo(), then in your
foo.cc (or foo.C) file, say

extern "C" {
    int init_foo();
}

Everything else can be in native C++, since the init_foo() routine will
resolve anything that would look strange to C.

Of course, this may work better with my version of perl.h, which is
already C++ clean...  :-)

: I can get a reference to myobject from perl by calling &new_myobject.
: Afterwards I can work from perl with the class like this:
: $object=&new_myobject(constructor vars);
: $result=&myobject_print($object);
: 
: everything works fine !. The only Problem is, if the ptr passed to
: myobject print is not a pointer to a class "myobject". The program
: will of course dump core. How I can make sure that myobject->print
: is only called with a valid ptr to an object of type myobject ?
: 
: One solution would be to implement a method "type" to all known objects
: and compare object->type, but most of the time i call functions with
: int's char's ... for which I can't implement such a method.
: 
: Another idea would be to keep a list of valid pointers for each known
: object and look up the adress. I think it's the only way.
: 
: Any idea ?

Since the pointer that Perl is passing around is presumably opaque, why
not pass a type around with that, and check it when you go to glue your
thread of control back into C++?

I find this very interesting, because I've got C++ linked with Perl right
now too.  Also, if you have any bright ideas for how you'd like to see
more object support in Perl 5, now's the time to speak up.  (I certainly
don't intend to turn Perl into C++, since C++ is already pretty good
at that.  But if I can do something to make the mapping a little less
painful, I'm all ears.)

Larry Wall
lwall@netlabs.com
Newsgroups: comp.lang.c++
From: jrobie@netmbx.netmbx.de (Jonathan Robie)
Subject: Re: Language extensions for run-time type identification
Organization: netmbx, Berlin, Germany
Date: Wed, 22 Jul 1992 07:33:27 GMT

pathak@mitre.org (Heeren Pathak) writes:

>Well, if the complier uses the class tree when it determines the type, it
>can generate "proper" run-time id for all objects in the tree.  That is I
>suggest that people look at using MI instead of pragmas.  

Compilation options and derivation are two separate issues, and I would
like them to stay separate.


Jonathan

===========================================================================

Jonathan Robie		jrobie@netmbx.UUCP
Arnold-Zweig-Str. 44	jrobie@netmbx.in-berlin.de
O-1100 Berlin		
Deutschland		Phone:  +37 (2) 472 04 19  (Home, East Berlin)
				+49 (30) 342 30 66 (Work, West Berlin)


-- 
Jonathan

===========================================================================