HDTenEightyP/NetNews huggingface dataset:
From: fmidgley@phoenix.Princeton.EDU (Frank M. Midgley)
Subject: Re: SOLVED: Template functions and g++  :-)
Summary: template confusion
Originator: news@nimaster
Keywords: g++, templates 
Organization: Princeton University
Date: Tue, 25 Aug 1992 22:46:16 GMT

g++ templaters:
  Bjoern Much has posted some of his code which allows templates to work under
g++.  The problem I have is not with the code itself, but with the fact that it
was necessary to create a .h file for every occurence of a template.

  I started using templates because I wanted to get rid of the 30 or so files I
had that implemented 6 linked lists with a common base using libg++.  I can't
see why the compiler can't be happy with just the template.  I don't see why
the compiler has to be 'spoon fed' such information as when to actually
generate the code for a template.
  I was under the impression that with templates, only one copy of the template
code was ever generated, thus giving templates their desirability.  If this is
the case, can't the compiler generate the template code for the .cc file
containing the template and leave 'hooks' to attach whatever type is being
'templated'?  This seems simply a matter of a few void*'s.
  I may be ranting, but it seems reasonable to me.  Anyway, any comments or
descriptions of how templating can be accomplished w/out extra files will be
_gladly_ accepted.
        -Frank
-- 
/-----------------------------------------------------------------------------\
| fmidgley@phoenix.princeton.edu  |    This space left blank due to a lack    |
|                                 |                                           |
| "Your fault -- core dumped."    |    of imagination.          So sue me.    |
From: shite@sinkhole.unf.edu (Stephen Hite)
Newsgroups: comp.lang.c++
Subject: Re: Stroustrup book - solutions to exercises?
Date: 23 Aug 92 18:09:29 GMT
Distribution: usa
Organization: University of North Florida, Jacksonville

In article <Aug.18.13.38.17.1992.4453@action.rutgers.edu> armhold@action.rutgers.edu (George Armhold) writes:
>
>Has anyone compiled a set of solutions to the exercises in the
>Stroustrup text?  I'm dutifully working my way through the exercises
>and it would be nice if there were some way I could double-check my
>answers.
>
>-George
>-- 
>		 Internet: armhold@dimacs.rutgers.edu
>	       UUCP: {backbone}!rutgers!dimacs!armhold
>		    BITNET: armhold@PISCES.BITNET

  I'll bet Tony Hansen is working on a second edition of his "C++ Answer
Book" that's just what you're looking for.  I'm sure the new one will
be just as terrific as the first one.   Dunno the release date.

Steve Hite
shite@sinkhole.unf.edu
From: philg@bozo.uucp (Phil Geller)
Newsgroups: comp.lang.c++
Subject: Class Documentation Generators
Keywords: documentation
Date: 2 Sep 92 18:45:28 GMT
Organization: Network Equipment Technologies

I am looking for tools that can generate documentation about C++ clases
from c++ header or code files.  Ideally they would generate a "man"
page format.  I know of two, but would like to find out if there are others, 
either public domain or commercially available.

The two I have are classdoc and genman.  The versions we have are
several years old.  If someone knows where we can get updates, that
would be useful.

If there is sufficient interest in this I'll post a summary.

+---------------------------------------------------------------+
|  Phil Geller				Email: philg@net.com	|
|  Network Equipment Technologies 	Phone: (415) 780-4363	|
|  800 Saginaw Drive 			Fax:   (415) 780-5001	|
|  Redwood City, CA 94063 					|
|								|
|  "It's all in the mind." - George Harrison			|
+---------------------------------------------------------------+
-- 
+---------------------------------------------------------------+
|  Phil Geller				Email: philg@net.com	|
|  Network Equipment Technologies 	Phone: (415) 780-4363	|
|  800 Saginaw Drive 			Fax:   (415) 780-5001	|
From: checker@acf5.NYU.EDU (checker)
Newsgroups: comp.lang.c++
Subject: Re: Callbacks - C++ needs an extension?
Date: 2 Sep 92 05:09:49 GMT
Distribution: comp
Organization: New York University

davidm@consilium.com (David S. Masterson) writes:
>Interesting technique, but I have a few questions:

>1.  Could you make this work in the case of windowing systems that treat
>callbacks as C functions?  Would it be a double callback (ie. callback to a C
>function that then calls the appropriate callback object)?

I'm working on this one.  I have an idea (in the formative stages) for a
way to bind the necessary object and its member function together into a
C style function using templates, but I'm going to wait until it is
better developed before I post it.

>2.  How does the windowing system pass data to the callback?  With buttons,
>for instance, all that needs to be known is the action (buttonPush).  With
>text widgets, though, the program will want to get at the data that is
>provided in the event.

See my latest post for the way to send data to the function.  Basically,
you use templates to specify the types you want the callback function to
take; it's easy.

>3.  Given a windowing system based on C, its likely that the information
>coming from the windowing system will not be C++ object oriented (ie. it won't
>follow a C++ inheritance model).  How do you convert?

This is a big problem.  The first step is to get as far away from the C
interface level as you can.  There are plenty of C++ abstractions for
almost any C based windowing system.  I haven't seen any that are
entirely satisfactory, but it is a young market, and that will change.

Chris
Newsgroups: comp.lang.c++
From: roberts@studguppy.lanl.gov (Doug Roberts)
Subject: NIH Class Libraries, g++ ?, latest version?
Organization: Technology Modeling and Analysis, LANL-A7
Date: Tue, 1 Sep 1992 18:07:52 GMT

Hello, all.

Does anybody know what the latest version of the NIH Class Library
is? From the README on 'alw.nih.gov` in the directory 'pub/NIHCL`:

>The NIH Class Library (NIHCL), a library of reusable C++ classes, can be
>obtained by "anonymous" ftp from 'alw.nih.gov` in the directory 'pub/NIHCL`.
>
>The file 'nihcl-3.0.tar.Z` is a compressed tar file holding all NIHCL
>source code, example code, and documentation.
>
>-r--r--r--  2 kgorlen    664692 May 30  1990 nihcl-3.0.tar.Z

Note that the file date is May, 1990.

Also, is there a version that compiles under gcc2.2.2?

Thanks!
--Doug
--

==================================================================
Douglas Roberts                |
Los Alamos National Laboratory | All good work is done in defiance
dzzr@lanl.gov                  |  of management. -- Bob Woodward
(505)667-4569                  |
==================================================================
From: rgp@mpd.tandem.com (Ramon Pantin)
Newsgroups: comp.lang.c++
Subject: Re: GOTO, was: Tiny proposal for na
Date: 28 Aug 92 05:37:15 GMT
Organization: Tandem Computers, Micro-Products Division

In article <rmartin.714931485@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
>hosken@spss.com (Bill Hosken) writes:
>
>>Clear thinking helps to write good code, gotos whether or not.
>
>This is sort of like saying:  "I am an expert driver, my clarity of
>driving skills entitles me to ignore certain stop signs, when I know
>(by virtue of my great skill) that there is no cross traffic.
>
>You see, I am such a good driver, that the legal alcohol limit does
>not apply to me.  Nor do speed limits, detour signs, or even
>the need to use headlights at night."
>...

When was the last time that a "goto" ran you over?  You should not
have been staring at the "breaks" and "continues" thru those x-windows
(peeping is illegal you know), you should have been paying attention
to the road, next time you might not be as lucky and a "mid-function"
return might hit you!  I understand that when you are riding in your
van full of state variables, redundant tests, duplicate code and added
complextity you might not be even able to see more than a couple of
yards away, anyhow remember to be very carefull when driving around
in those conditions, you might even be able to get one of those signs
for the handicapped.  :-)

Anyhow, you can't really do nothing about it, nobody is going to outlaw
any of these, nobody is going to stop using them either, even if you
don't like them (we like them), so learn to live with them.

>In software engineering, we have rules, but no cops.  (And I don't
>want any cops either).  So "real good programmers" sometimes feel that
>the rules don't apply to them.  We average types suffer at their hands.

The problem is that when you say "we have rules" you mean "I have rules",
you have your rules and I have my rules.  I don't feel guilty when I
use breaks, continues, returns, gotos or when I decide that a state
variable makes more sense than any of these.  If you don't like using
some of these, that is ok also, go ahead and don't use them, don't be
afraid, I won't send my cops to look at your code.

Textbook software engineering for computer science students is not
exactly how things work in the real world.  If somebody in the real world
is making you "suffer at their hands" with good old C code, you can always
find yourself a project that is being done strictly under your rules.
If you can't find one, then you might be more tolerant of all the
programmers that have not seen the light and give them some space.
Please don't suffer too much if one of them puts a "break" in one of
your statefull loops.

Ramon Pantin
From: rmartin@thor.Rational.COM (Bob Martin)
Newsgroups: comp.lang.c++
Subject: Re: Destruction of temporaries
Date: 1 Sep 92 14:02:48 GMT

adk@Warren.MENTORG.COM (Ajay Kamdar) writes:

|In article <rmartin.715101472@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
|>
|>No, I want a warning every time a temporary gets converted into a
|>pointer.  
|>
|>In your example:  Given String::operator char*(); 
|>                    and String String::operator+(const String&);  : 
|>
|>String a,b;
|>char* c = a+b;
|>
|>An implicit conversion to char* takes place on a temporary.  A warning
|>should be possible.  
|>

|But what if operator char* () is coded as follows:

|String::operator char*()
|{
|    char *ncptr = new char[strlen(d_cptr) + 1];
|      // d_cptr is the data member pointing to String's char* representation
|    strcpy(ncptr, d_cptr);
|	return ncptr;
|      // reclamation of newed memory is somehow taken care of
|}

|I wouldn't want the compiler to issue warnings in such a case, irrespective
|of whether operator char*() was called on a temporary or not.

Then, you should cajole your compiler vender into supplying you with a
compiler which provides you with the type of #pragma control that lets
you supress the warnings on a function by function basis.


--
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: jss@lucid.com (Jerry Schwarz)
Subject: Re: <stdio.h> and <iostream.h>
Reply-To: jss@lucid.com (Jerry Schwarz)
Organization: Lucid, Inc.
Date: Wed, 2 Sep 92 18:02:30 GMT

In article <1SEP199214472267@cnsvax.uwec.edu>, tannerrj@cnsvax.uwec.edu (Power = 486 + HST Dual Standard) writes:
|> I am trying to put a text windowing environment on a C++ program
|> that I have created. The text windowing environment is DFLAT from 
|> DDJ magazine. The problem is DFLAT is ANSI C using stdio.h and
|> my program is a C++ program with iostream.h. I have read that there
|> are potential dangers in mixing the two. Any suggestions? Thanks.
|> 

The problems with mixing stdio and iostream is one of syncronization.
That is since stdio and iostream are each doing their own buffering
it is possible that

	printf("stdio ") ;
	cout << "iostream " ;

would end up with output

	iostream stdio

If you can arrange for flush to be called at appropriate points
there is never any problem.  Some implementations
of stdio will automatically flush when a newline is printed
to certain output devices (this is called line buffering), and the 
endl iostream manipulator also flushes.  

Alternatively you can call ios::sync_with_stdio before you do
any other iostream operations.  This will cause cout and cerr
to be connected to stdout and stderr which will allow for
(almost) arbitrary mixing.

There is never any problem when stdio and iostreams are
being used on different files.  

  -- Jerry Schwarz
From: checker@acf5.NYU.EDU (checker)
Newsgroups: comp.lang.c++
Subject: Re: Callbacks - C++ needs an extension?
Date: 2 Sep 92 05:25:31 GMT
Organization: New York University

soloway@midniteoil.Eng.Sun.COM (Mark Soloway) writes:
>This article describes a method I use to provide a convenient C++
>callback interface for XView and provide the ability to encapsulate
>callback behavior in a subclass.  The method described is used in
>UIT V2.
[explanation deleted]

The problem with this class of technique (I'll call them the casting
techniques) is that the compiler can't do anything for you.  You are
completely on you own to match the types of function and object
pointers.  Even normally innocuous conversions (derived to base, etc.)
become deadly and can't be tolerated by the code.  These conversions
are hard to find because they may work properly with a single
inheritance hierarchy but fail when multiple inheritance is added.

That isn't to say that I have a better solution, though.  :(

Chris
Newsgroups: comp.lang.c++
From: wilson@mailhost.aa.cad.slb.com (David Wilson)
Newsgroups: comp.lang.c++
Subject: Did I just shoot myself in the foot?
Date: 31 Aug 92 15:35:01 GMT
Organization: Schlumberger CAD/CAM at Ann Arbor, MI

I just ordered Borland C++ with Application Framework from a mail order
house.  Did I shoot myself in the foot?

Here's the problem:  I have a 286 with 1 meg of memory.  A review in the
last issue of PC Magazine indicated a meg of extended memory is also required.
I called Borland, and was told the compiler would run on my machine.  With
that confirmation, I went ahead and ordered.  I only want to run under DOS,
developing for DOS with TurboVision, for the time being.  Am I going to be
able to, or am I going to have to shell out for extended memory??

Email me if you think this question is too elementary to interest the
entire group.

Dave Wilson
From: tmb@arolla.idiap.ch (Thomas M. Breuel)
Newsgroups: comp.lang.c++
Subject: Re: How to hack c++ into doing late binding ?
Date: 31 Aug 92 23:10:17 GMT
	<1992Aug11.000613.6607@leland.Stanford.EDU>
	<1992Aug13.151003.15231@ucc.su.OZ.AU>
Reply-To: tmb@idiap.ch
Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
	Perceptive)
In-reply-to: maxtal@extro.ucc.su.OZ.AU's message of 13 Aug 92 15:10:03 GMT

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

	   C++ has no run-time system (except for new/delete).
   Instead it relys on the operating system.
   What you need to do 'dynamic linkage' is a decent operating system.
   Windows and OS/2 do exactly what you want. I do it, it
   works superbly. So your problem is that Unix is a brain dead
   operating system :-) 

Actually, many versions of UNIX support dynamic linking, and there are
even two libraries that are portable to multiple machines and versions
of UNIX.

It's easy to claim to "standardize" lots of features (Windows, OS/2)
if you only have one system running on only one hardware platform...

					Thomas.

Newsgroups: comp.lang.c++
From: pat@frumious.uucp (Patrick Smith)
Subject: Re: Destruction of temporaries
Date: Wed, 2 Sep 1992 04:28:56 GMT
Reply-To: uunet.ca!frumious!pat
Organization: None

ark@alice.UUCP () writes:
|The unfortunate reality is that I have seen a number of development
|projects that have an inflexible rule -- no warnings allowed!  That is,
|they will not allow their people to ship any code that generates warnings.

I am one of those people who believe it is worth going to a lot of
effort to ensure that code compiles with no warnings at all.
That way, new warnings stick out like a sore thumb, instead of
being lost in a mass of old warnings that you know don't indicate
real problems.

But promoting this philosophy to an 'inflexible rule' is, as you
said, unfortunate.


|Warnings had better be right almost all the time.

Actually, what I would want is

- Warnings should often indicate real problems.

- Whenever code generates a warning but doesn't contain a real
  problem, it should be possible to rewrite the code so it doesn't
  generate a warning.  Preferably with no loss of efficiency.


|				--Andrew Koenig
|				  ark@europa.att.com


-- 
Patrick Smith
uunet.ca!frumious!pat
pat%frumious.uucp@uunet.ca
From: obourdon@France.Sun.COM (Olivier Bourdon - Sun ICNC)
Newsgroups: comp.lang.c++
Subject: Generic types
Date: 28 Aug 1992 14:03:06 GMT
Organization: SunConnect
Distribution: world
NNTP-Posting-Host: sunalps.france.sun.com

Let's assume I have two different types of objects (classes)
//-------------------
class complex {
public:
	int i,j;
	...
	void Print();
};
//--------------------
class string
public:
	char *str;
	...
	void Print();
};

and I also have a double linked list
//-----------------
class list {
	void *element;
	list *next, *prev;
	void Print();
};

then I woul like to do something like :
void list::Print() {
	while (this->next!=NULL)
		this->elem->Print();
		...
}

I know that it does not work AT COMPILE TIME because the Print function is not
	a member function for void * type. It seems like I could create sur-classes
	of list by removing the element field in the list class and adding :
class stringlist {
	string *element ;
	...
};

but then I have to write 2 times the EXACTLY SAME CODE once for
stringlist::Print and the other one for complexlist::Print
and I would like to have only one piece of code so that if I have to
modify it I do it only at one place

Thanks for any idea
Olivier

-- 
+---------------------------------+-----------------------------------+
|Olivier BOURDON                  | Address : SUN MICROSYSTEMS        |
|E-Mail : obourdon@France.Sun.COM |           International Center for|
|Tel : +33 76 41 42 19            |           Network Computing       |
|Fax : +33 76 41 42 41            |           32 av du Vieux Chene    |
|                                 |           38 240 Meylan Zirst     |
|member of OSI development team   |                  FRANCE           |
+---------------------------------+-----------------------------------+
From: kopp@oasys.dt.navy.mil (Paul Kopp)
Newsgroups: comp.lang.c++
Subject: GNU C++ for VAX VMS 5.3?
Date: 4 Sep 92 20:48:13 GMT
Reply-To: kopp@oasys.dt.navy.mil (Paul Kopp)
Organization: Carderock Division, NSWC, Bethesda, MD

I am seeking a ftp host site for the GNU C++ 2.2 (?, the one with templates)
compiler for a VAX VMS 5.3 system. I only have DEC Fortran so if I need to
compile or recompile the C++ compiler, what else would I need?

Thanx in advance. :)

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<>                                          <>              /|\           <>
<>  Paul J. Kopp, Naval Architect           <>            /  | \          <>
<>                                          <>           /   |  \         <>
<>  David Taylor Model Basin                <>          /    |   \        <>
<>  Carderock Division Headquarters         <>         /     |    \       <>
<>  Naval Surface Warfare Center            <>        /      |     \      <>
<>  Code 1561, Surface Ship Dynamics Branch <>        -------|      \     <>
<>  Bethesda, Maryland   20084-5000         <>    |----------+-------/    <>
<>                                          <>     \               /      <>
<>  voice: 301-227-5119                     <> ~~~~~~~~~~~~~~~~~~~~~~~~~  <>
<>  fax:   301-227-5442                     <>                            <>
<>  email: kopp@oasys.dt.navy.mil           <>    I'd rather be sailing   <>
<>  compu$erve: 76156,251                   <>           naked            <>
<>                                          <>                            <>
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
From: kers@hplb.hpl.hp.com (Chris Dollin)
Date: Fri, 4 Sep 1992 08:14:15 GMT
Subject: Re: Re: GOTO, was: Tiny proposal for named loops.
Organization: Hewlett-Packard Laboratories, Bristol, UK.
Newsgroups: comp.lang.c++

In article ... kers@hplb.hpl.hp.com (me!) writes:

[various things taking Bob Martin to task for ``proven that these rules are
always workable''] 

I forgot to add that, despite my remarks, I am rabidly anti-goto, and that my
intention was not to support GOTOs as an everyday programming tool, but to
point out that there are useful, understandable control structures other than
the Holy Trinity of structured programming.

Perhaps I should have had my tea first.
--

Regards,    | "If taking devious pains was a sign of laziness, he was quite
Kers.       | prepared to call Hazelton the laziest man alive." Blish (m-o-l)
From: rvenu@phoenix.sni-usa.com (Ramakrishnan Venugopal)
Newsgroups: comp.lang.c++
Subject: National Institues of Health (NIH) C++ Class Libraries and X11
Date: 3 Sep 92 16:55:45 GMT
Reply-To: rvenu@phoenix.sni-usa.com (Ramakrishnan Venugopal)
Organization: Siemens-Nixdorf Information Systems, Inc. Cambridge, MA

This is just a comment ...

NIH Class libraries inherit from a class called Object (in Object.h) 
and X11 has also an "Object" data structure giving me some headache 
when I tried to compile.  I find it strange that NIH has not changed the
name Object to something more creative.

Anybody faced this problem ?
From: nsundare@silver.ucs.indiana.edu (Neelakantan Sundaresan)
Newsgroups: comp.lang.c++
Subject: Problem with templates...
Date: 3 Sep 92 22:45:07 GMT
Organization: Indiana University
X-Mailer: ELM [version 2.3 PL11]


I am trying to separate compile template definitions and use.
For instance,
 file1.c has
 -----

#include <stdio.h>
#include <stdarg.h>
#include "file1.h"

template <class T> XT<T>::Xtest(T t)
{ printf("HEE\n");
  return 0;
}
template <class T> XT<T>::XT(){}

 file2.c has
 ------

#include <stdio.h>
#include <stdarg.h>
#include "file1.h"

main()
{
  typedef XT<int> Y;
  Y x;
  x.Xtest(4);
}

  file1.h has
  -------

template <class T> class XT {
 public:
   XT();
   Xtest(T);
};


------------ On compiling with g++ and linking I get the error
 undefined symbol:
	 ___t2XT1Zi 
         _Xtest__t2XT1Zii 

But if I have file1.c and file2.c in the same file, everything seems
to be okay.


Any ideas as to what is going on?
thanks
Neel.
Newsgroups: comp.lang.c++
From: stevep@ims.com (Steve Poulsen)
Subject: Re: ENCRYPTION OF DATA FILE ACCESSED BY MY C++ PROGRAM
Organization: Integrated Measurement Systems, Inc.
Date: Tue, 25 Aug 1992 15:09:03 GMT

In article <1992Aug24.180739.24295@vuse.vanderbilt.edu>, jem@vuse.vanderbilt.edu (John Eric Meyer) writes:
|>
|> There is bound to be a newsgroup pertinent to the topic.  Does anybody know
|> the specifics?

sci.crypt

--
Steve Poulsen, Integrated Measurement Systems, Inc.  Beaverton, OR  USA
Voice: 503-626-7117   Fax: 503-644-6969   Fidonet: 1:105/31.6
INTERNET: stevep@ims.com   Compuserve: [70262,3115]
From: antony@ee.uts.edu.au (Antony Richards)
Subject: Name mangling
Organization: University of Technology, Sydney, Australia
Date: Fri, 4 Sep 1992 01:13:12 GMT

Sorry if this is a FAQ but,

I need to implement a name mangling function that mimics the one used by the
GNU C++ compiler.  This is so I can extend a dynamic linker to C++.  Can
anybody who knows the algorithm used please post/rely to the news group.  I
will sumarise the replies I get.

Thanks in advance,
Antony Richards.
Newsgroups: comp.lang.c++
From: tiller@solace.me.uiuc.edu (Mike Tiller)
Subject: Sockets?
Organization: University of Illinois at Urbana
Date: Thu, 3 Sep 1992 21:47:06 GMT
Keywords: sockets

	I know this probably gets asked all the time, but
does anyone have a good, "free" implementation of socket
communications using C++ classes that runs under gcc-2.2.2
and is simple?  I checked the FAQ and it didn't say anything.
It doesn't necessarily even have to use iostreams.

Michael Tiller
(tiller@solace.me.uiuc.edu)


Newsgroups: comp.lang.c++