HDTenEightyP/NetNews huggingface dataset:
From: KOCHER@nvdv01.ind.e-technik.uni-stuttgart.de (HARTMUT KOCHER)
Newsgroups: comp.lang.c++
Subject: Re: template with pointer to member function
Date: 12 Oct 92 15:03:37 GMT
Organization: University of Stuttgart, IND (FRG)
X-News-Reader: VMS NEWS 1.23

In <BRISTER.92Oct9112529@tirade.decwrl.dec.com> brister@decwrl.dec.com writes:

> On Fri, 9 Oct 1992 14:22:36 GMT, LANG@nvdv01.ind.e-technik.uni-stuttgart.de (MARTIN LANG) said:
> 
> > In the following example we have class template, that takes two arguments,
> > a class T and a pointer to member function. We want the function f of
> > the template class Test to call this member function. Currently, this
> > only works for member functions of class Z. What we really want is
> > a more general version of the template that calls the member function of 
> > the same class T as the type of the first parameter i.e. a template like
> > template<class T, void (T::*err_fct)()>. Our compiler complains about
> > this version. How can it be done?
> 
> The answer I heard from one of our compiler/debugger people was that the
> C++ grammer disallows this in some way because if T is instantiated over a
> built-in type like int, then the construct is illegal. He couldn't remember
> the section of the grammer that states this, and I don't have the energy to
> dig through it myself. Personally I think this should be legal with
> checking done at a later point to see if T ends up being mapped to a
> built-in type.
> 
> James
> --
> James Brister                                           brister@wsl.pa.dec.com
> DEC Western Software Lab., Palo Alto, CA                        decwrl!brister
I couldn't find anything in the grammar about it. You can always write
templates that will not compile for certain types. So there seems to be 
no reason to disallow the above construct. 
The question is still open. How can I write a template that takes a class
and a member function of that class and calls it directly. (I'm very well
aware that I can store a pointer to the member function, and call it later
using that pointer. But I want it without paying the overhead in time 
and space!). It should be somehow possible. Any ideas?

Hartmut Kocher
University of Stuttgart 
Newsgroups: comp.lang.c++
From: trix@cbnewsm.cb.att.com (t.roger.kiang)
Subject: Re: NIHCL
Organization: AT&T
Distribution: na
Date: Tue, 13 Oct 1992 10:47:38 GMT
Keywords: C++ NIHCL

From Andrew Koenig:
>NIHCL is a `US Government Work.'  That means it is in the public domain,
>it is not, and cannot be copyrighted, and anyone may use it for any purpose.
>-- 
>				--Andrew Koenig
>
>				ark@europa.att.com

If that's true, then what was all that bruhaha when
NIH try to patent those genetic patterns they found
in their research.  I was glad to see that the patent
office rejected their claim, but of course, NIH
can appeal.  On the other hand is there a difference
for government work in dealing with copyright versus
patents?

Roger Kiang
trix@edsel.att.com
Newsgroups: comp.lang.c++
From: thail@seas.gwu.edu (Samuel R. Posten)
Subject: borland 3.0 and 3.1
Originator: thail@seas.gwu.edu
Organization: George Washington University
Date: Wed, 14 Oct 1992 01:17:41 GMT

Hi, quick question.  When I run either versions IDE to run a program I get
erratic results, such as caps lock coming on at random times, and
highlighting coming on without my turning it on.  The strange part is that
it only happens when I have QEMM or emm386.sys loaded.  No other programs
act wacky like this.  Any ideas?  I've tried blocking out memory sections
in qemm, but no luck.
Sam
Who hates waiting on hold for borland when he's paying.
From: LANG@nvdv01.ind.e-technik.uni-stuttgart.de (MARTIN LANG)
Newsgroups: comp.lang.c++
Subject: template with pointer to member function
Date: 9 Oct 92 14:22:36 GMT
Organization: University of Stuttgart, IND (FRG)
X-News-Reader: VMS NEWS 1.23

In the following example we have class template, that takes two arguments,
a class T and a pointer to member function. We want the function f of
the template class Test to call this member function. Currently, this
only works for member functions of class Z. What we really want is
a more general version of the template that calls the member function of 
the same class T as the type of the first parameter i.e. a template like
template<class T, void (T::*err_fct)()>. Our compiler complains about
this version. How can it be done?

class Z 
{
 public:
  void xyz(){};
};

template<class T,void (Z::*err_fct)()>
class Test
{
 public:
  void f();
};


template<class T, void (Z::*err_fct)()>
void Test<T,err_fct>::f()
{
 T x;
 (x.*err_fct)();
}

main()
{
 Test<Z,Z::xyz> t;
 t.f();
 return 0;
}


Any help would be appreciated.


Martin Lang,
Hartmut Kocher

University of Stuttgart, IND
Newsgroups: comp.lang.c++
From: nh@cbnewsg.cb.att.com (nicholas.hounsome)
Subject: Re: Proposal: Preconditions and PostConditions in C++
Organization: AT&T
Date: Wed, 7 Oct 1992 08:29:27 GMT

Note that preconditions and invariants can be handled fairly well
with macros in the code (although having them in the header is 
difficult or impossible). It is postconditions for methods that are hard
because we require access to the old value.

If we take a copy on function entry should we use the methods defined and 
risk recursion or just do a shallow copy?

Of course we could do without old but it is necessary for any
useful postcondition.

It seems to me that the old value of ANY variable accessible to a 
function should be available to a postcondition if we allow postconditions
on non member functions - this is impossible to achieve with any 
reasonable macro scheme.

P.S. Have you seen EC++.

Nick Hounsome
From: lld@concept.de (Lothar Linhard)
Newsgroups: comp.lang.c++
Subject: NIHCL with gcc 2.2.2 (g++) ?
Keywords: NIHCL GNU g++
Date: 7 Oct 92 16:50:41 GMT
Organization: concept engineering GmbH, D-7800 Freiburg, Germany



Has anybody made some experiances when compiling the NIH class library
with the newest GNU g++ compiler (gcc 2.2.2).

Are patches available ?

Thanks for help.

Lothar.

================================================================================
Lothar Linhard                         |  Tel.:  ..49-761-473099
concept engineering GmbH               |  Fax.:  ..49-761-441063
Burkheimer Str. 10                     |  
D-7800 Freiburg (Germany West)         |  
--------------------------------------------------------------------------------
Email:                       lld@concept.de
   or: (uucp domain)         lld@concept.uucp
   or: (uucp notation)       ...!unido!concept!lld
================================================================================
From: dodd@dodd.UUCP (Mike Dodd)
Newsgroups: comp.lang.c++
Subject:  Paradox Engine Wrapper? wanted.
Date: Wed, 07 Oct 1992 06:26:29 GMT
Distribution:  world
Organization: Not
X-Newsreader: Arn V1.00 beta rel2

I have heard Paradox Engine (a C (or pascal) based product) has been
used in C++ code.  My question is, where can I find examples of this 
type of conversion.  I own a registered copy of Paradox Engine and would
like to use it in a C++ program now.

If noone knows where I can find Paradox Engine 'wrapper' examples, could
someone help me with some other examples of 'wrapping' a C based product,
i.e. one where I don't have the original code to merge into my own, just
a pre-written library I link.  

I'm going to be using BC3.1 and OWL (application framework for my GUI).
I have Advanced C++ by Coplien, he mentions 'wrappers' but goes no further
that I could see.  None of my other books has any mention of them at all.
This COULD be a very simple concept if someone knows it already, and all
that needs to be said is a few well chosen words, but I am at a total loss
for understanding what to do.

Much thanks.
			    -Mike

+-----------------------------------------------------------------------+
|   Michael E. Dodd		Internet:  dodd!dodd@seq.uncwil.edu     |
|   219 Pershing Court		Voice:     919/799-9453                 |
|   Wilmington, N.C. 28412	(Answering Machine on between 4-10PM)   |
+-----------------------------------------------------------------------+
From: kestes@nswc-wo.nswc.navy.mil (Kent Estes)
Newsgroups: comp.lang.c++
Subject: Microsoft Database info needed...
Date: 16 Oct 92 14:55:26 GMT
Article-I.D.: relay.1992Oct16.145526.28912
Organization: Naval Surface Warfare Center

Hello,

Does anybody out there have format info on the database the Microsoft
C compilers build when compiling C programs?

tnx kl.  (kestes@nswc-wo.navy.mil)
Newsgroups: comp.lang.c++
From: hansen@hecto.cs.umn.edu (David M. Hansen)
Subject: Re: streams
Organization: University of Minnesota
Date: Thu, 15 Oct 1992 22:22:31 GMT

In article <rmartin.719166192@donner>, rmartin@donner.Rational.COM (Bob Martin) writes:
|> cshaver@informix.com (Craig Shaver) writes:
|> 
|> >In article <1992Oct13.155518.22845@rs6000.bham.ac.uk> pickerig@dns0.bham.ac.uk (Mr. G. Pickering) writes:
|> >>My first reaction is to use FILE functions rather than streams, unless
|> >>you have a good reason to use streams. This is just the way I do things,
|> >>feel free to flame me for this.
|> 
|> >Praise the lord for a breath of fresh air -- streams are hard to use!
|> 
|> IMHO this statement is too strong.  Streams are different, to be sure;
|> but they are not truly hard to use.  Moreover, they have a number of
|> advantages that should not be ignored.  
    < Advantages of Streams omitted >

OK, I'm a relative newcomer to C++ (I started my first non-trivial project
about a month ago), but I have some impressions I'd like to share.

When programming in C, I use usually use printf, fprintf, and sprintf to 
produce formatted output.  In C++, I like ostreams and use them extensively.

However, when programming in C, I avoid scanf like the plague -- There is just
too much that can go wrong, and it makes it difficult to handle errors correctly.
In most cases, I read a string using gets or an equivalent, or even one character
at a time using getc, and do my own formatting and converting.  It doesn't 
necessarily make for the fastest, smallest, or prettiest code, but I am
sure it's going to work the way I want it to.

In C++, I haven't used istreams much, except for simple things.  When things get
complex, I find myself working _around_ istreams rather than _with_ them.  In
most cases, I just fall back on lower-level input routines, just as I do in C.
I don't think this is so bad, since the I/O is generally (in all cases so far,
anyway) encapsulated within a class.

I guess the difference is that _I_ have control over my output, so I can use
the abstraction supplied by ostreams to simplify my program,  but I have _no_
control over the input to the program, and I have to be prepared to handle 
anything.

Just one newbie's opinion.

					-=Dave


Newsgroups: comp.lang.c++,comp.std.c++
From: dak@tabaqui.informatik.rwth-aachen.de (David Kastrup)
Subject: Re: Should friends obey access?
Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
Date:  9 Oct 92 18:07:58 GMT

Friends are usually designed along with a class. Whereas derived classes
are designed in a later development step, friends are designed alongo
with the class. Consequently there is not much harm in giving
friends the same access as class members.

If some function needs access to protected parts of your interface,
you can still define it as a friend of the appropriate derived class,
where it probably belongs. Declaring someone to be your friend who is
not in the same compilation unit as yourself may be considered foolish.

But remember, C++ tries to protect from accident, not from fraught.
To split the meaning of friends would really not gain much, except
a feeling of security when compiling friends which are not designed
by yourself.
Newsgroups: comp.lang.c++,comp.std.c++
From: shang@corp.mot.com (David (Lujun) Shang)
Subject: Re: The concept of templates considered ill designed
Reply-To: shang@corp.mot.com
Organization: Motorola, Inc., Software Research and Development, Rolling Meadows, IL. 60008
Date: Wed, 7 Oct 92 15:05:01 GMT

In article <23822@alice.att.com> ark@alice.att.com (Andrew Koenig) writes:
> For example, suppose we have a class:
> 
> 	class Foo {
> 	public:
> 		void mem(int);
> 	};
> 
> and a template function:
> 
> 	template<class T> void f(T t) { t.mem(0); }
>

I soppose f is defined as:

     <class T[Foo]> void f(T t) { t.mem(0); };

where keyword template is not necessary, because "f" can be called
directly without any instantiation.

> You are saying that constraining T to be of class Foo or a class
> derived from Foo will make it possible to type-check this template
> at compile time.  Wel, what about this?
> 
> 	class Bar: public Foo {
> 	public:
> 		void mem(int);
> 		void mem(void*);
> 	};
> 
> If we call f with an argument of type Bar, it will fail during instantiation
> with an ambiguity error.

I suppose "mem" defined in Foo is a virtual function, otherwise "t.mem(0)" 
will always call the "mem" defined in Foo.

Calling f with an argument of type Bar causes no ambiguity. The actual 
member function called is the "mem" that overrides the virtual "mem (int)"
defined in Foo.

> The only way to avoid this is to say that the type
> constraint also constrains the call of t.mem(0) to just those instances of
> mem defined in the base class 

Not necessarily. Constrained parameterized function is not a template 
function. It does not necessarily act exactly like a template, just as a
 template function does not necessarily act exactly like a macro definition.

> -- but in that case, you will still get in
> trouble with this one:
> 
> 	class Baz: public Foo {
> 	public:
> 		void mem(long);
> 		void mem(double);
> 	};
>

No trouble. Foo::mem(int) will be called because you did not override it.
   
> This stuff is **difficult**!  Don't take it lightly!

Agree. But it is not a novel stuff. 


David Shang
From: feustel@netcom.com (David Feustel)
Newsgroups: comp.lang.c++
Subject: Re: New Zortech C++ Release?
Date: 10 Oct 92 12:58:25 GMT
Organization: DAFCO: OS/2 Software Support & Consulting

bright@nazgul.UUCP (Walter Bright) writes:

>jordan@aero.org (Larry M. Jordan) writes:
>/Yesterday I received a copy of "Programmer's Paradise" in the mail and noticed
>/an ad for a verion of Zortech C++ for OS/2 that supports the AT&T v3.0 standard,
>/including templates.  I did not find a similar ad for DOS or WINDOWS.
>/I'm confused.  Did PP jump the gun?  Is a version of Zortech which supports
>/templates imminent?  How much longer must I wait?  (If something doesn't happen
>/soon I'll just buy a copy of Turbo C++ for Windows and be done with it.)

>PP didn't jump the gun. We had a couple of bugs which has
>delayed the OS/2 compiler release. The Symantec dev tools group is working
>night and day to get it released.

I called Symantec about this product and was told that the initial
product does not include a debugger. This is why the IBM developers
toolkit is needed to use it. I also was told that the compiler would
not be shipped for several weeks. It seems to me that $250 for an
upgrade that consists primarily of adding the capability of linking
32-bit code (the compiler already generated 32-bit code linkable in
dos) is a bit much. I was really looking forward to this product, but
in view of the price I'm waiting to see 

- what IBM comes up with for an os/2 C++ compiler (and for how much)
- ditto for Borland
- a review of the Zortech Compiler's os/2 32-bit code generating 
  performance. 
-- 
Dave Feustel N9MYI <feustel@netcom.com>
 
[.sig on vacation]
From: brister@decwrl.dec.com (James Brister)
Newsgroups: comp.lang.c++
Subject: Re: template with pointer to member function
Date: 9 Oct 92 18:25:29 GMT
Organization: DEC Western Software Lab

On Fri, 9 Oct 1992 14:22:36 GMT, LANG@nvdv01.ind.e-technik.uni-stuttgart.de (MARTIN LANG) said:

> In the following example we have class template, that takes two arguments,
> a class T and a pointer to member function. We want the function f of
> the template class Test to call this member function. Currently, this
> only works for member functions of class Z. What we really want is
> a more general version of the template that calls the member function of 
> the same class T as the type of the first parameter i.e. a template like
> template<class T, void (T::*err_fct)()>. Our compiler complains about
> this version. How can it be done?

The answer I heard from one of our compiler/debugger people was that the
C++ grammer disallows this in some way because if T is instantiated over a
built-in type like int, then the construct is illegal. He couldn't remember
the section of the grammer that states this, and I don't have the energy to
dig through it myself. Personally I think this should be legal with
checking done at a later point to see if T ends up being mapped to a
built-in type.

James
--
James Brister                                           brister@wsl.pa.dec.com
DEC Western Software Lab., Palo Alto, CA                        decwrl!brister
Newsgroups: comp.lang.c++
From: pbray@firebird.newcastle.edu.au (Peter Bray)
Subject: Warnings in AT&T C++ v3.01b / Templates
Summary: Help needed on AT&T C++ v3.01b Warning message
Keywords: AT&T C++ v3.01b, Warnings, Templates
Organization: Application Specific Computer Design, The University of Newcastle
Date: Tue, 13 Oct 1992 00:37:33 GMT


Greetings,

	I'm having a problem with AT&T C++ v3.01b ( SunOS4.1.2 ), the
following warning is being generated for the code below I have stripped the
code slightly to help show the problem. This warning along with others is also
generated for the standard include file <iostream.h>.

	Any help, would be greatly appreciated, as this warning seems to be the
cause of another small error, I'm experiencing. I'll be only to happy to post a
summary of the responses.

Peter

------------------------------------------------------------------------------
Peter Bray: Application Specific Computer Design      Phone : (049) 21 5963
	    Dept. Electrical & Computer Engineering   Fax   : (049) 60 1712
	    University of Newcastle                   Email : InterNet/AARNet
	    Callaghan NSW 2308  AUSTRALIA         pbray@ascod.newcastle.edu.au
------------------------------------------------------------------------------

[ascod] 1 > CC  +w +p -g Problem.C
CC  +g +w +p Problem.C:
"Problem.C", line 16: warning: copy constructors should take a const  Integer& not a  Integer&
cc  -L/usr/att/lib   -g Problem.c -lC
[ascod] 2 > cat Problem.C
//
// Required typedef for portability
//
typedef int		Integer;		// 32 bit   signed

const	Null = 0;

template <class Type>
class ListItem
{
public:
	ListItem	( const ListItem<Type>& li );

	ListItem	( const Type& i,
			  ListItem<Type>* Next = Null,
			  ListItem<Type>* Prev = Null );
	// This constructor causes the problem.

	~ListItem	( void );

private:
	Type		theData;
	ListItem*	previous;
	ListItem*	next;
};

int main( void )
{

	ListItem<Integer> CausesWarning( 1 );

	return 0;
}

// The implementation ( not required, included for completeness )
template< class Type >
ListItem<Type>::ListItem ( const ListItem<Type>& li )
	: theData( li.theData ), previous( li.previous ), next( li.next )
{
}

template< class Type >
ListItem<Type>::ListItem ( const Type& i, ListItem<Type>* Next, ListItem<Type>* Prev )
	: theData( i ), previous( Prev ), next( Next )
{
}

template< class Type >
ListItem<Type>::~ListItem ( void )
{
}

// Thanks in Advance :-)

Newsgroups: comp.lang.c++
From: dahl@odie.ee.wits.ac.za (Bradley Dahl)
Subject: OOD and Simulation
Keywords: OOD, C++, simulation, networks, internets
Organization: Wits Electrical Engineering (Novell Users).
Distribution: all
Date: Fri, 9 Oct 1992 09:25:38 GMT

Hope this the right group...

Do you, or do you know of someone that is working on simulator designs 
using OOD methodologies?  A few postgrads (of which I'm one) are using C++
to construct simulators for networks and internet related protocols and
would be interested to know what work is being done by other people in this 
field.

If you can fill me in, please use email - I don't read this group regularly.

Thanks

Brad

Newsgroups: comp.lang.c++
From: rmartin@donner.Rational.COM (Bob Martin)
Subject: Re: virtual destructors
Organization: Rational
Date: Thu, 15 Oct 1992 16:00:02 GMT

As a rule, destructors should be declared virtual.  This is the safest
practice.  It is true that virtual destructors are not appropriate to
all classes, but the decision to remove the virtual attribute from a
destructor should be made deliberately.

Virtual destructors are not *needed* in classes which do not support
polymorphic subclasses.  However, the penalty for a virtual destructor
is so low as to make it nearly absurd not to take the precaution and
make the destructor virtual.

In some cases, memory and timing constraints will be so stringent,
that the overhead of the vtbl, and the indirect virtual function call
will be significant.  In such cases, the destructor should not be
virtual. 


--
Robert Martin                        Training courses offered in:
R. C. M. Consulting                       Object Oriented Analysis
2080 Cranbrook Rd.                        Object Oriented Design
Green Oaks, Il 60048 (708) 918-1004       C++
From: pfbertra@watcgl.uwaterloo.ca (Philippe F. Bertrand)
Newsgroups: comp.lang.c++
Subject: gnu 2.2.2 warning message
Date: 8 Oct 92 02:57:35 GMT
Organization: Computer Graphics Lab [CGL], University of Waterloo
X-Mailer: ELM [version 2.3 PL11]


Compile a class derived privately from a template class with virtuals results
in the following sort of messages:

graphics-server.c:183: warning: shadowing member `GetClient' with member functio
n

183 is the line:
    GenericServer<GraphicsInitData,GraphicsRequest>::Debug( );

Notes
=====
The functions listed in the warning are functions that are not overidden by
functions in the derived class (maybe hidden is a better word).

``GenericServer<GraphicsInitData,GraphicsRequest>( ... )'' is
how the constructor is called (parameters replaced with ...)

Debug and all functions listed are not virtual but other tests have shown that
the warning messages still occur when they are virtual

when line 183 is removed, the warnings go away !



Question:
=========
what does this warning mean ???

Please reply with email,  thanks,

- Philippe F. Bertrand                          pfbertrand@watcgl.uwaterloo.ca 
Computer Graphics Lab, Department of Computer Science,
University of Waterloo, Waterloo, Canada  N2L 3G1
Newsgroups: comp.lang.c++
From: bruceb@ctpm.uq.oz.au (Bruce Blackshaw)
Subject: Loading Icons
Summary: Icon loading problem solved!!
Keywords: icon
Organization: Centre for Language Teaching and Research, Uni of Queensland, AUSTRALIA.
Date: 15 Oct 92 01:13:10 GMT

Thanks to those who responded re my problem about loading icons.
The problem was that even though I was using 
     wc.hIcon = LoadIcon( GetApplication(()->hInstance, "MG_ICON");
in the GetWindowClass function, when I added the icon resource
called MG_ICON to the .rc file Resource Workshop prompted me for
a value to add to the .h file resulting in #define MG_ICON  201
in the .h file.  This was simply placing 201 in the LoadIcon function
so that the MG_ICON ICON midge.ico line in the .rc was not being
referenced.     

Summary:  to load a custom icon, don't have its resource identifier
          #defined in a .h file.

--
****************************************************
Bruce Blackshaw bruceb@ctpm.uq.oz.au   
"... I'd rather be hang gliding ..."
****************************************************