HDTenEightyP/NetNews huggingface dataset:
From: jamshid@ut-emx.uucp (Jamshid Afshar)
Newsgroups: comp.lang.c++
Subject: Re: where do templates go?
Summary: what techniques do compiler writers have planned for templates?
Date: 16 Nov 92 01:18:29 GMT
Reply-To: jamshid@emx.utexas.edu
Organization: The University of Texas at Austin; Austin, Texas

In article <1992Nov9.174401.415@nrao.edu> cflatter@nrao.edu writes:
>In article 92Nov9082600@tohi.DMI.USherb.Ca, dechc00@tohi.DMI.USherb.Ca (CHRISTIAN DECHAMPLAIN) writes:
>>
>>I'm using g++.  Suppose I'm using many compilation modules.  Where do the
>>templates go?  [...]
>
>You have to put the template code in the header files.  The section of the ARM
>you are referring to is part ofthe commentary and not the language definition.
>I expect that CYGNUS will come up with better template handling features for
>g++ in the future.

I recommend #include'ing the .cc/.cpp files inside the header files.

	// List.h
	#ifndef List_H
	#define List_H

	#include <...>

	template<class T> class List { ... };

	template<class T> inline void List<T>::append(...

	#ifndef DONT_INCLUDE_CC
	#include "List.cc"  // non-inline member function definitions
	#endif

	#endif // List_H

I've been doing this under BC++ 3.1 and if I understand the above it
also works under g++.  I believe cfront (sort-of) does the #include
automaticly, so you may have to define DONT_INCLUDE_CC when porting to
cfront.

At least under BC++, all the template functions and member functions
in List.cc are compiled into any module that uses List<T>.  The linker
does only put one version of those template functions, for each T,
into the final executable.  While this method is very conveniant, it
does mean long compile times since the non-inline List code for a
particular T will be compiled in multiple modules.  Therefore, for
larger projects I use the alternative method of forcing expansion of
the non-inline functions in one .cc file using #pragmas (this is a
major hassle because of various size limitations).

I am curious what techniques compiler writers are considering (or
using now?) for solving this problem.  That is, how will the
non-inline template functions be compiled only once for a particular
instantiation, without user intervention?  It would be good if this
compilation were done on the first occurance of a particular List<T>
instead of waiting until the link.

Jamshid Afshar
jamshid@emx.utexas.edu
Newsgroups: comp.lang.c++
From: cnc@sweep.bt.co.uk (Colin Crist)
Newsgroups: comp.lang.c++
Subject: Re: comp.lang.c++
Date: 20 Nov 92 10:56:30 GMT
Reply-To: cnc@sweep.bt.co.uk
Organization: British Telecom

I'm sure that many of you are in the same position as myself and a number
of other C++ developers I know, that is the sheer volume of mail in comp.lang,
much of it NOT about the language per se, means that we busy C++ developers don't
get a chance to read everything and so there is less chance of a question that we
have the answer to being answered.

I simply don't have the time to wade through 50+ messages every morning, and from
just one group ! It's  shame, but I'd end up spending half the day reading and 
replying to mail and probably get my contract terminated :-(

The split could be along the lines of:
	1) Language issues and standardisation
	2) Bugs, etc relating to specific compilers
	3) Tools and development envireonments eg ObjectCenter
	4) erm....

Cheers,
	Colin

-----------------------------------------------------------------------
Colin Crist	
BT Research Labs			+44 473 648136
Martlesham Heath			cnc@muppet.bt.co.uk
Suffolk
United Kingdom				Standard disclaimer...
Newsgroups: comp.lang.c++,comp.std.c++
From: xjzhu@math.uwaterloo.ca (Xiaojun Zhu)
Subject: Can we refer to A<T, S> when we are constructing A<S, T>? A challenge!
Keywords: template, argument switching
Organization: University of Waterloo
Date: Tue, 24 Nov 1992 02:45:17 GMT

I have an interesting question for you C++ experts out there.

Q: Can we refer to A<T, S> when we are constructing A<S, T>?

I had experimented it with AT&T C++ V3.0 and the fun part is probably not
to give you the answer.

Please answer the following questions before resorting to your compiler.
(out of your knowledge)

Q1: Should we be allowed to use or not to use? 

Q2: Why or why not?

template<class S, class T>
class A
{
  S _s;
  T _t;
public:
 //...
 // the following function is trying to switch a._s and a._t
 // to give me an A<T, S> object.
 friend A<T,S>& SWITCH(A<S,T>& a);  // interesting place
                  
};


--------------------------------------------------------------
   A template version of my signature class is under repair.
Symptom: It dies without a warning if I use certain class 
         as an argument.
         
                                       xjzhu@math.uwaterloo.ca
--------------------------------------------------------------
Newsgroups: comp.lang.c++
From: adelt@imada.ou.dk (Adel Shavandi)
Subject: packing/unpacking unsigned in char ?
Summary: packing/unpacking unsigned in char ?
Keywords: packing/unpacking unsigned in char
Organization: Dept. of Math. & Computer Science, Odense University, Denmark
Date: Sun, 15 Nov 1992 22:51:51 GMT



I need some suggestions for an effective and correct way to
pack/unpack unsigneds in [0,127] in chars and communicate
them to another process.  

What i do myself is as the following code:


// child process:
	// ...
	unsigned num1;
	// ...
	// num1 is in [0,127] now
	printf("%c",num1); // later is rediercted to parent by pipe mech.
	// ...


// parent process:
	// ...
	unsigned num2;
	char ch;
	int n=read (fd,&ch,1);
	if (n>0)
		num2=(unsigned) ch;
	// ...


Now i know this may be wrong since sometimes i receive some wrong
numbers. Any ideas/suggestions ?

But what is interesting is that the wrong numbers are very similiar
each time. Am i confronting with pitfalls ?! 





Hope somebody have some good ideas/suggestions.




			Regards,

				Ade'l

Newsgroups: comp.lang.c++
From: andrew@tagsys.com (Andrew Gideon)
Subject: Complexity in the eyes of the beholder?
Organization: TAG Systems inc.
Date: Wed, 18 Nov 1992 02:45:53 GMT

I have been having an extended discussion with a coworker.
This is someone whom I respect, and with whom I enjoy
working a great deal.  But this discussion is disturbing
to me.  He claims that I use too many layers of abstraction.

Specifics: I am of the "small class" and "mixin" school.
I tend to write small classes, with tight functionality.
I then combine these into classes providing greater and
greater functionality.

The purpose of this is to achieve a comprehendable
system.  If I make a single class too complex, I find 
that *I* cannot grasp the functionality of the class.  I
certainly wouldn't expect another to do so.

On the other hand, I can grasp a simple class entirely:
interface and implementation.  When I "move up" a level,
I can drop the implementation information, and need
retain only the interface information.  The class becomes
a black box.

To me, I achieve my goal (except when I violate my own
rules - which does happen more frequently than I like {8^).
But this coworker claims that the many levels are too
complex to follow.  In trying to understand a class, he
is forced to recurse too frequently and too far.

Unfortunately, I do understand his point.  I too have been
frustrated similarly - by my own code!  But this seems an
acceptable cost for having a system that can eventually 
be understood.  Besides, I seem to be used to this form
of reverse engineering.

Am I wrong?  Is he?  Am I missing something obvious?
Any comments welcome.

Thanks for your attention.

	- Andrew Gideon



=== 
 -----------------------------------------------------------
| Andrew Gideon              |                              |
| Consultant                 |                              |
|                            |   TAG Systems inc.           |
| Tel: (201) 890-7189        |   D2-181 Long Hill Road      |
| Fax: (201) 890-1581        |   Little Falls, N.J., 07424  |
| andrew@tagsys.com          |                              |
 -----------------------------------------------------------
From: scottdl@hpmwtd.sr.hp.com (Scott LaFrancois)
Date: Wed, 18 Nov 1992 18:15:17 GMT
Subject: VGA ftp site & FAQ file ?
Organization: HP Santa Rosa Site (SRSD MWTD)
Newsgroups: comp.lang.c++

 I am in need of a 640x480x256 VGA driver for Borland Turbo C++.  Does
 anyone know if there is a ftp site were I might be able to find it.  I
 would also like to get a copy of the FAQ file for this group.  Please
 reply via e-mail to scottdl@sr.hp.com.  Thanks in advance.
From: vincent@datmuc.UUCP (vincent)
Newsgroups: comp.lang.c++
Subject: Re: comp.lang.c++
Date: 19 Nov 92 10:05:14 GMT
Organization: DAT

>mat@mole-end.matawan.nj.us writes:
>|(Howard Pinsley) writes:
>|
>|> (Roger Haaheim) writes:
>|> : (John MAX Skaller) writes:
>|
>|> : > 	It might be appropriate to have a comp.newuser.c++
>|> :                                           ^^^^^^^^^^^^^^^^
>|> Why split it up?  If newuser-type ...
>|> ...  Let's stay together.
>|
>|As much as I want to encourage and help new people, I also need ...

>|At the very least, I would like to see `environment' stuff (how to compile,
> ....
>comp.lang.c++.pedantry or some such.  (comp.unix.wizards might be
>the model to follow, but perhaps with a less stringent meaning
>of "wizard".)

Well to start how about stoping all cross posting between this group
and comp.std.c++.

I Also vote for a hierachy (if someone invents one)

i.e. 
	comp. lang. c++.  std	  (discusion on standard (old comp.std.c++)
			. advocay (discusion on new isues)
			. problems (bugs, code, problems)
			. tools    (tools ..., porting,)
			. source... 
			. don't_know_anmore_idea. bye.bye

ciao vincent@datmuc.dat.de

Newsgroups: cvnet.c++,comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: self-reproducing C++ program
Organization: TauMetric Corporation
Date: Wed, 18 Nov 1992 17:42:40 GMT

brianm@cc.gatech.edu (Brian N. Miller) writes:

>In article <1919@alcbel.be> ldup@ta7s49.alcbel.be (Luc Duponcheel) writes:

>> <<';'<<

>This won't work, because character constants are converted to ints.
>This will output the ascii decimal equivalent of ';', right?

This was the case with C++ and stream libraries up to about 1988.

Since then, a character literal is of type char, not int.   The
definition of the stream classes was changed so that the expression
	cout << 'x'
prints the letter 'x', not the internal code for 'x'.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
From: njs@planet.bt.co.uk
Newsgroups: comp.lang.c++
Subject: Re: comp.lang.c++
Date: 17 Nov 92 12:16:12 GMT
Organization: DNM42, BT Labs, Martlesham Heath, Ipswich, UK.
Originator: njs@andromeda


In article <74566@hydra.gatech.EDU>, collins@emperor.gatech.edu (Tom Collins) writes:
|> In article <1992Nov11.183520.15567@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
|> >	comp.lang.c++ is certainly getting flooded.
|> >
|> >	It might be appropriate to have a comp.newuser.c++
|> >group or some other forum to soak up some of the postings 
|> >that really have nowhere else to go.
|> >
|> >	Any comments?
|> 
|> Yes, one fundamental comment.
|> 
|> We should partition the group functionally, not on the basis of
|> experience.  Choice of platform and operating system is a good
|> method (PC/DOS, etc.).   Application area is another possibility.
|> But a major aspect of these newsgroups is the ability to interact
|> with others who know more (or less).
|> 

You do have a point there, but a group that contained questions from people new to the language wouldn't prevent other people being interested also, especially those kind enough to answer other peoples questions.  What it would do is identify those aspects of the language that people find difficult to grasp.  This information could then be fed back into C++ training to improve teaching materials.


Nathan
From: iab@cstr.ed.ac.uk
Newsgroups: comp.lang.c++
Subject: operator overloading
Date: 16 Nov 92 20:01:45 GMT
Reply-To: iab@cstr.ed.ac.uk ()
Organization: Centre for Speech Technology Research, Edinburgh University


I'm looking for some help with operator overloading. I have
successfully overloaded operators acting on statically declared  user
defined classes but I would like to declare my classes dynamically and
still use my overloaded operators. Is this possible, i.e. to use
overloaded operators on pointers to a class without dereferencing
explicitly.     

-- Iain Ballantyne (iab@cstr.ed.ac.uk)




--



----------------------------------ooOOoo-------------------------------------
Newsgroups: comp.lang.c++
From: nikki@trmphrst.demon.co.uk (Nikki Locke)
Subject: Re: Idempotent header file proposal
Reply-To: nikki@trmphrst.demon.co.uk
Distribution: world
X-Mailer: cppnews $Revision: 1.20 $
Organization: Trumphurst Ltd.
Date: Mon, 23 Nov 1992 12:36:19 +0000

In article <1992Nov20.200435.18239@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
> Ultimately we will begin to see more and more C++
> development environments that not only offer precompiled headers, but
> incremental compile/link support as well.
It is unfortunate that most of the current compilers which have
precompiled headers have such restrictions on their use, and such arcane 
command lines to use them, that they introduce problems, rather than 
solving them.

For example, all the compilers I have seen with this feature insist that 
all modules that use the precompiled headers include the same headers, in 
exactly the same order. This encourages users to include ALL their headers
in all their modules. This introduces lots of unnecessary dependencies, 
and means a very slow compile cycle when the code is moved to another 
compiler, without precompiled headers.

Unfortunately, this awfulness is likely to spread - in the first place, 
compiler vendors who have precompiled headers see this method as a good 
thing, because it locks users into their compiler. Compiler vendors 
introducing precompiled headers feel they should implement them in a 
way compatible with (e.g.) Microsoft.

Of course, having "proper" separately precompiled headers, which can be 
individually included only when actually needed, is much more difficult to
do, so we are probably stuck with the (IMHO) nasty hack vendors supply at 
present.
-- 
Nikki Locke,Trumphurst Ltd.(PC and Unix consultancy) nikki@trmphrst.demon.co.uk
trmphrst.demon.co.uk is NOT affiliated with ANY other sites at demon.co.uk.
Newsgroups: comp.lang.c++,comp.std.c++
From: sasghm@theseus.unx.sas.com (Gary Merrill)
Subject: Re: something nasty report
Originator: sasghm@theseus.unx.sas.com
Date: Mon, 16 Nov 1992 15:50:23 GMT
Organization: SAS Institute Inc.


In article <1992Nov14.233744.27337@ornl.gov>, mullens@jamsun.ic.ornl.gov (James A. Mullens) writes:

|> When I'm faced with an access violation/segmentation violation/bus error,
|> and I really have no clue as to what's causing it, I start removing large
|> blocks of source code with #if 0 ... #endif until the compiler finishes
|> successfully.  Then I reintroduce parts of code until the compiler bombs
|> again.  In the end, the problem is isolated.  I may have a programming
|> error there, or the compiler may just be batty.  I always send a bug report.
|> I'd like to send a bill for my time ( at $60/hour :-).

Pretty irritating, isn't it?  Certainly *we* expect to receive a bug report
if our compiler behaves in this way -- and having someone pinpoint the
problem with a test case of a finite number of lines is heavenly.
If you don't have debuggable version of the compiler (and most production
versions aren't), these things are *hard* to find.  $60/hr would be
a bargain.
-- 
Gary H. Merrill  [Principal Systems Developer, C Compiler Development]
SAS Institute Inc. / SAS Campus Dr. / Cary, NC  27513 / (919) 677-8000
sasghm@theseus.unx.sas.com ... !mcnc!sas!sasghm
From: ezachris@iroquois.ucs.indiana.edu
Newsgroups: comp.lang.c++
Subject: Multiple Inheritance - Necessary?
Keywords: c++ inheritance
Date: 20 Nov 92 20:23:11 GMT
Organization: Indiana University


Hello!

A friend of mine who programs in Objective-C argues that multiple  
inheritance is unnecessary and complicated. 

Let's say you have a pencil-object and an eraser-object and to create a  
pencil-with-an-eraser-on-it you'd inherit from both the pencil and the  
eraser object, right?

Like this:

          PENCIL           ERASER
             ^              ^
              \            /
               \          /
             PENCIL-WITH-ERASER

My Objective-C friend would make a new object "Pencil-with-eraser" that  
would declare two objects inside it.

Like this:

     PENCIL-WITH-ERASER
        Eraser TheEraser(...);
        Pencil ThePencil(...);

To implement the functionality of the pencil and the eraser he'd write a  
bunch of functions that call the functions inside the pencil and the  
eraser objects. 

I think this sounds like hogwash. What do you think?
From: karl@BofA.com (Karl Nicholas)
Subject: Re: Complexity in the eyes of the beholder?
Organization: Bank of America, Capital Products, RMTG #5906
Date: Thu, 19 Nov 92 22:19:23 GMT

In article <1992Nov18.024553.24081@tagsys.com> andrew@tagsys.com (Andrew Gideon) writes:
>
>On the other hand, I can grasp a simple class entirely:
>interface and implementation.  When I "move up" a level,
>I can drop the implementation information, and need
>retain only the interface information.  The class becomes
>a black box.
>
>To me, I achieve my goal (except when I violate my own
>rules - which does happen more frequently than I like {8^).
>But this coworker claims that the many levels are too
>complex to follow.  In trying to understand a class, he
>is forced to recurse too frequently and too far.
>
 But why is he recursing into the subclasses? It would seem
to me that he should be taking the classes that he deals
with for what they are, and not worry about how they work.

 This may not be of much help either because I guess
I do not understand his point either. Perhaps you could help
him with a class "flowchart", outlining subclasses and 
the bullet point functionality of the class and a flowchart
of hiearchy or inheritence.

  I think the tradeoff is speed of code verses modularity.
many classes supports modularity, which from a systems
standpoint is preferable, where larger classes supports
speed of execution, which from a user standpoint is
preferable. I try to incorporate as much modularity
as possible until the speed for the user becomes a problem.

-- 
 +---------------------------------------------------------------------------+
 | Karl Nicholas   (415) 953-0409    | Beer is good food.  Food is not beer. |
 | karl@BofA.COM   uunet!odinba!karl | *** BofA is not me, I am not BofA *** |
 +---------------------------------------------------------------------------+
From: kilitzir@antigone.csi.forth.gr (Xristos Kilitzirakis)
Newsgroups: comp.lang.c++
Subject: How about that ??
Date: 23 Nov 1992 18:25:32 +0200
Organization: Institute of Computer Science, FORTH Hellas
NNTP-Posting-Host: antigone.csi.forth.gr

Well , this should be tricky.
I want to build an object matrix , such that the type of its
data can be determined at run time ( for normal/double/no precision).
for ex.
Any ideas  ? 
Templates don't seem a good idea,because it's early binding.
Yet it's the only way.The solution would be easy, if we had a typeof(.).



XXXristos K.
Newsgroups: comp.lang.c++
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: STACKER and BORLAND C++ FOR WINDOWS
Organization: Texas Instruments Inc
Date: Tue, 17 Nov 1992 22:47:12 GMT

In <1992Nov17.140414.4113@admin1.memst.edu> jasmith@admin1.memst.edu (John) writes:

>             I have a question concerning STACKER and BORLAND C++ FOR WINDOWS.
>        I'm not sure if this is the right place to ask this question, but my 
>        question is as follows.  

It's not.

>                                    I have run the installation program for
>        STACKER on my hard drive that creates the main boot drive D: and the
>        STACKER compressed drive C:.  My version of BORLAND C++ FOR WINDOWS was
>        compressed on the STACKER compressed drive C:.  I try to use the 
>        debugger that comes with the BORLAND package and I receive an error
>        telling me that the file WINDEBUG.DLL can not be open.  The DLL is a 
>        compressed format for the C++ Link Library (*.LIB).  

Actually, a DLL is a Windows Dynamic Link Library, and they work just
fine coming from a Stacker drive.

>        I know that the
>        STACKER can not handle compressed files.  

Since when?  True, it won't COMPRESS them any more, but what do you
think it doesn't do?

>        I would like to know if any
>        one using BORLAND C++ FOR WINDOWS has run into this problem.  I have 
>        noticed that I can not open any of the DLL files that are currently 
>        located on the STACKER compressed drive.  

And have you changed all the internal paths to point to where the DLLs
now are?  I would bet that your problem is that you are lying to the
compiler about where it should look for this stuff.

-- 
"Insisting on perfect safety is for people who don't have the balls to live
 in the real world."   -- Mary Shafer, NASA Ames Dryden
------------------------------------------------------------------------------
Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
Newsgroups: comp.lang.c++
From: pjl@cs.uiuc.edu (Paul Lucas)
Subject: Re: Complex Numbers
Organization: University of Illinois at Urbana-Champaign
Distribution: usa
Date: Sat, 21 Nov 1992 17:01:12 GMT

In <By1I4o.GKs@cs.columbia.edu> benderly@cs.columbia.edu (Dan Benderly) writes:

>Hi,
>	I am doing a circuit analysis project in C++ that requires the use
>of complex numbers.  Does C++ have any special functions to handle them?

	No.

>Are there any special include files that do complex numbers?

	complex.h
-- 
	- Paul J. Lucas				University of Illinois	
	  AT&T Bell Laboratories		at Urbana-Champaign
	  Naperville, IL			pjl@cs.uiuc.edu
Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Squares and Rectangles (Re: Const Inheritance)
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Thu, 19 Nov 1992 17:17:31 GMT

In article <721507350snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk writes:
>In article <1992Nov4.165028.1273@wam.umd.edu> krc@wam.umd.edu (Kevin R. Coombes) writes:
>> From a mathematical point of view, there is no question about the
>> relationship that should hold. Every rectangle IS-A polygon, with
>> four sides and four right angles. Every square IS-A rectangle with
>> four equal sides. 

>I think our problem here is that we have two separate meanings of "is-a".
>In the geometrical sense, any particular Square "is-a" Rectangle. But, 
>geometrically, the shape of any given object is fixed, so setWidth() and
>setHeight() methods do not make sense geometrically. If you make all 
>objects of fixed size and shape, then a Square is-indeed-a Rectangle.

	More or less mathematical 'objects' are values, and not
'OO' objects (which tend to be mutable). Using classes for these things
is more in the ADT flavour than OO.

	An abstract class 'Shape' may allow, for example an
'Expand' function for 'located' objects that have a definite
point (about which to expand) and exist in a coordinate frame,
but couldnt have a 'SetWidth' function.

-- 
;----------------------------------------------------------------------
        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++,comp.std.c++