HDTenEightyP/NetNews huggingface dataset:
From: pete@cssc-syd.tansu.com.au (Peter Alexander Merel)
Subject: Re: Proposal - enhancement for switch statement.
Organization: AOTC - CSSC
Date: Thu, 19 Nov 1992 21:32:23 GMT

mccauleyba@vax1.bham.ac.uk (Brian McCauley) writes:
>No. Please not another token in the parser.

Agreed. The C++ philosophy appears to be, only add a token if there's just
no other way at all.

>The only problem is that if a class has both an `operator==(int)' and an
>`operator int ()' defined inconsistantly the some existing switch 
>statements would change their meaning.

I thought about this a little, and thanks to Mike Tiller for raising it
privately. Mike raised an associated problem, that operator== doesn't
have to return an int, but can return any damned thing it pleases ...
so a really perverse operator== might return something that can't cast
into an int.

But how about this: 

switch looks, in the first instance, for a way to cast the switch 
expression and case constants into int. That should keep existing code 
from breaking.

Failing to find a way to do this, switch looks for an operator== on the
type returned from the switch expression with a distinctive signature, say

int const operator==(foo const &  bar) const

There's a precedent for this sort of usage in the copy constructor, and
of course this way the case constants can have different types to match
different overloaded operator==.

>switch(TRUE) {
>  case expr1: { /* code */} break;
>  case expr2: { /* code */} break;
>  delfault: {/* code */}
>}

>This is exactly equivalent to an if ladder but some people think it looks
>nicer :-)

Looks way cool, but I think there's a little inconsistency with the previous
switch - you've got the constant at the top, and we'd have to commute the
operator== to get it to fly. Sounds messy to me.

-- 
Internet: pete@cssc-syd.tansu.com.au   UUCP: {uunet,mcvax}!munnari!cssc-syd!pete
Snail: 1/18-20 Orion Road, Lane Cove NSW 2066 Australia    Phone: +61 2 911 3130
I am a big pond in a small fish.
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c++
Subject: Re: New Employee Test
Date: 20 Nov 92 23:58:14 GMT
Organization: negligable

A portfolio, by it's very nature, shows the candidate only
at his/her best.

A "pop quiz" is a better measure of what they are capable of
under "real world" conditions.

Although a portfolio might be a nice supplement.


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
But now I'm grasping			|
that understanding			|	-Richard Hartman	
is only part of love.			|	hartman@uLogic.COM
Newsgroups: comp.lang.c++,gnu.g++.help
From: cmlow@iti.gov.sg (Low Chee Meng (KSL))
Subject: HELP -- questions from novice user on G++/LIBG++
Keywords: gcc, g++, libg++
Organization: National Computer Board, Singapore
Date: Thu, 19 Nov 1992 04:44:06 GMT

Hi,

I am a novice user of G++ (we have GCC 2.3.1 installed here). Can
someone help me out with these questions?

a) What are the files in the "include/gen" directory for? I vaguely
   remember someone mentioning "genclass" in association with these
   files, but I cannot find any documentation regarding the use of
   genclass at all.

b) The abovementioned files seems to use some kind of non-standard
   template notation (?). Are these classes obsoleted by the 
   availability of a more standard template feature in the current 
   versions of G++?

c) Are the tar tapes from FSF and from Cygnus identical in content
   (with regards to documentation, especially!)?

d) How does the LIBG++ library compares to COOL or NIHCL? Are they
   substitutes for each other? or can they work together?

Many many thanks in advance,

Chee Meng

Subject: Test


-- 
---------------------------------------------------------------------
Chee-Meng Low (cmlow@iti.gov.sg) (fax: 65-777-3043)
Knowledge Systems Lab, Information Technology Institute, Singapore
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
From: fox@pt0204.pto.ford.com (Ken Fox)
Newsgroups: comp.lang.c++
Subject: typedefs in the scope of a class
Date: 16 Nov 1992 23:03:11 GMT
Organization: Power Train Systems, Ford Motor Company
Distribution: world
Reply-To: fox@pt0204.pto.ford.com
NNTP-Posting-Host: pt0204.pto.ford.com
Keywords: typedef, scope, name space

I've come across strange behavior (at least to me...) in the interpretation
of "nested" classes.  I want classes stored in files according to functional
classification, but also I want to place them into a "package," or name
space that I can control.  I thought that I could just create bizzare class
names and then use typedefs to put them into the scope of a class which would
serve as my name space... but I'm obviously missing something here because
this "simple" example won't work.

Could somebody please explain this?

// ======================================================================
// BAD CODE - Why is this broken?
// ======================================================================

class myint
{
    public:
	int value;
};

class scope
{
    public:
	typedef int SystemInt;
	typedef myint CustomInt;
};

int main()
{
    scope::SystemInt i;

    // syntax error on next declaration!

    // cfront 2.1: CustomInt is not a type name
    // gcc 2.3: `CustomInt' is not a member of type `scope'

    scope::CustomInt j;
}

// ======================================================================
// GOOD CODE - Why this and not that?
// ======================================================================

class scope
{
    public:
	typedef int SystemInt;
	class CustomInt
	{
	    public:
		int value;
	};
};

int main()
{
    scope::SystemInt i;
    scope::CustomInt j;
}

Thanks in advance...

-- 

Ken Fox (fox@pt0204.pto.ford.com)  | My opinions or statements do not
                                   | represent those of, nor are endorsed by,
                                   | Ford Motor Company.
CAD/CAM Technology Section         |
CAD/CAM/CAE Process Integration    | "Is this some sort of trick question
Ford Motor Company                 |  or what?" -- Calvin
From: je@unix.brighton.ac.uk (John English)
Newsgroups: comp.lang.c++
Subject: Re: New Employee Test
Date: 19 Nov 92 10:21:26 GMT
Organization: University of Brighton, UK

assist@orion.oac.uci.edu (ASSIST Coordination Site) writes:
: i am in the process of hiring 2 C++ programmers.  This Wednesday 11/18/92
: we are cunducting the final interviews with 4 candidates.
: 
: I have a C++ question I would like them to address (sort of a programming
: test, but not really) but I'm not sure if it's too simple or too complex.
: 
: I could also use some suggestions on what might be usefull to ask them.

Hey, interviewees... are you reading this thread?
-- 
-------------------------------------------------------------------------------
John English			| "Yes, understanding today's complex world of
Dept. of Computing		|  the future IS a little like having bees live
University of Brighton		|  in your head... but, there they are..."
Janet: je @ unix.brighton.ac.uk	| "People who live in windowed environments
Fax:   0273 642405		|  shouldn't cast pointers"
-------------------------------------------------------------------------------
Newsgroups: comp.lang.c++
From: gregc@eagle.fsl.noaa.gov (Greg Compestine)
Subject: Re: New Employee Test
Organization: Forecast Systems Lab, NOAA - Boulder CO, USA
Date: Fri, 20 Nov 1992 01:51:36 GMT


    In the book "Peopleware" (which I think should be required
reading for anyone managing programmers), they suggest the 
"audition".  A candidate is asked to make a presentation on
a topic of their choice, so long as its technical in nature,
and preferably related to the job being offered.  The presentation 
is made to the team that will be working with the candidate.  It 
should take 30 to 60 minutes, and at the end of the presentation
the candidate has to field questions.

    This is an excellent test of a person's ability to communicate
technical information, and gives everyone in the team a say 
on the candidate.

   Another item mentioned in the book is a protfolio.  I've
put together one for myself that contains samples of code and
documentation that I've written.  I personally think a portfolio
would be a better measure of a programmer than a pop quiz.

gerG
Newsgroups: comp.lang.c++
From: rmartin@thor.Rational.COM (Bob Martin)
Subject: On Trees vs. Forests.  was: Should I use a generic object...
Organization: Rational
Date: Fri, 20 Nov 1992 17:18:24 GMT

The discussion of tree vs. forest models is quite interesting.

Definitions:

	Tree:	A class library whose component classes all derive from
		a common base class; typically named "Object".

	Forest:	A class library whose component classes do not have a
		common ancestor.  Inheritance may exist, but the
		absence of a common base means that there are many
		unrelated inheritance hierarchies, or trees, thus the
		name.

The tree model has the advantage that every object will inherit some
baseline functionality.  For example, every object may inherit the
ability to print standard debugging messages, or the ability to know
the name of its class.  Every object could inherit the ability to
Print or Dump or Gargle with salt water.

Among the disadvantages of the tree model are the fact that each of
the objects will carry along a little bit of excess baggage.
Regardless of whether the object uses the inherited features of
Object, it will carry those features along with it.  This is perhaps a
bit inefficient.  

Worse, two tree libraries constructed with different Objects as the
base class will almost certainly be incompatible.

The forest model has the advantage that each of the inheritance
hierarchies within it are independent.  This makes for slightly
smaller objects, and for more compatibility between libraries.  Two
forest libraries can be merged into a single project with far less
difficulty than two tree liraries.

The disadvantages of the forest model are the lack of common paradigms
for dealing with the objects.  Each object may have a Print or Gargle
method, but there is no common abstract class which encapsulates that
ability.  Moreover, since reqularity is not enforced, Print and Gargle
may have different signatures and behave in different ways.

For my part, I prefer forest models.  I don't like the idea of a big
mamma object on top of everything.  I feel that it makes the code less
mobile and less compatible with others.  But I have used the tree
model in the past, and acknowledge some of its benefits.  But I think
that the forest model imposes fewer constraints and makes the code a
bit easier to work with.


--
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: steve@taumet.com (Steve Clamage)
Subject: Re: Wisdom on f(...,const class& xxx = default_xxx)
Organization: TauMetric Corporation
Date: Mon, 16 Nov 1992 17:41:52 GMT

mg@tyrolia (Michael Golan) writes:


>what's the net wisdom on a default parameter which is a class? ...

>My best solution is 

>T Default_T(0) ;	// global default class T

>and

>void f(...., const T& = Default_T);

>But this goes "against"  OO, and pollute the name space. Anyone has a better
>solution (trick?)

I suggest not using default parameters, but using overloaded functions
instead.  This avoids quite a few problems associated with default
parameters.  Example:
	void f(int, const T&);

	void f(int i)
	{
	    static T t;
	    f(i, t);
	}

If you can't stand the overhead of an extra function call, you could
combine this with someone else's suggestion of a static class member
(because an inline function can't have static local variables).
Example:

	class T {
	public:
	    static T t;	// for default parameters of type T
	    ...
	};
	void f(int, const T&);
	inline void f(int i) { f(i, T::t); }

When default parameters are not simple literals, they sometimes result
in unexpected behavior due to scope interactions, and sometimes
interact unexpectedly with function overloading.  Using explicit
overloading instead as above often results in more reliable and
maintainable programs.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
From: xklaus@kommu.UUCP (Hr Klaus Neuberger)
Newsgroups: comp.lang.c++
Subject: Borland address or phone number????
Date: 16 Nov 92 13:51:07 GMT
Organization: SNC
X-Newsreader: Tin 1.1 PL5

Hello

Can anybody out there give me the address or a phone nubmer of Borland in USA???

Thanks in advance

xklaus
Newsgroups: comp.lang.c++
From: jimad@microsoft.com (Jim Adcock)
Subject: Re: self-reproducing C++ program
Date: 18 Nov 92 23:17:30 GMT
Organization: Microsoft Corporation

In article <1992Nov17.144939.21793@cc.gatech.edu> brianm@cc.gatech.edu (Brian N. Miller) writes:
|> <<';'<<
|
|This won't work, because character constants are converted to ints.
|This will output the ascii decimal equivalent of ';', right?

wrong -- unless you have a very old C++ compiler.  For some years
now C++ compilers have recognized chars as a distinct type, including
char constants.  This issue is different then in C++ than in C.
Further, recently the C++ standardization committee has voted to 
recognize wide char types as also being their own distinct type, thus allowing
proper Unicode I/O via streams.
From: jjamison@bellahs.com (John Jamison RD AC)
Subject: Re: Is Ctor X() required for the object of class X to be able to be dynamically allocated?
Summary:  Yes
Keywords: constructor X(), dynamic allocation
Organization: Bell Atlantic Healthcare Systems
Date: Thu, 19 Nov 1992 19:10:43 GMT

In article <BxxC3p.Btn@math.uwaterloo.ca> xjzhu@math.uwaterloo.ca (Xiaojun Zhu) writes:
>Q: Is it necessary to have a constructor which took no argument in order
>   for the object of a class to be able to be dynamically allocated?
>
>More specifically,  I have a class X, when I can say
>
>X *x=new X[10] ?
>
>Is it required that class X have a constructor X()?
>
I can't cite chapter and verse, but such a constructor is required to
create arrays of objects.

-- 
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
John Jamison
Bell Atlantic Healthcare Systems
Newsgroups: comp.lang.c++,comp.sys.mac.programmer
From: blob@gallant.apple.com (Brian Bechtel)
Subject: Re: Is anyone using MacApp for serious development?
Date: Fri, 20 Nov 1992 15:55:30 GMT
Organization: Apple Computer Inc.

ferdie@coyote.datalog.com (fred jarvis) writes:

>   Is anyone using MacApp for serious development?

>   My employer is developing MS Windows applications
>(currently in C) and wants to convert one of our programs
>to the Mac.  My preference is MacApp so I can develop
>in C++.  However, browsing through a copy of "Develop,
>The Apple Technical Journal" (Issue 10),  I see nary a word
>about MacApp or OOP.  Do true Mac gurus not use MacApp?

Yes, quite a few "Mac gurus" use MacApp.  In fact, I'd estimate (guess)
slightly less than 1/3 of our commercial developers use MacApp.  Some
smaller percentage use Think Class Library, which is C+- based (i.e.
Think C 5.0.4 doesn't support all of C++).  MacApp is a mature and full
featured application framework.

(The AppleLink MacApp3tech$ mailing list has over 300 entries, if that
additional number tells anything.)

I'd have to say that determining that Mac gurus don't use MacApp based
on one issue of a technical journal is rather like looking at
one day's worth of articles in rec.sport.hockey, not seeing any articles
on college hockey in the USA, and concluding that hockey isn't played by
any colleges in the USA.

Look at other issues of Develop and you'll find code written in
MacApp.

--Brian Bechtel     blob@apple.com     "My opinion, not Apple's"
Newsgroups: comp.lang.c++
From: rkinder@iat.holonet.net (Robert J. Kinder)
Subject: Re: Using delete with arrays - help please!
Organization: HoloNet (BBS: 510-704-1058)
Date: Tue, 17 Nov 1992 05:32:02 GMT

Borland C++ 3.1 has two implementations of operator new() and delete(). 
These may be found in the files vnew.cpp, vdel.cpp, new.cpp, and del.cpp.

The vnew.cpp & vdel.cpp are for 'vector' (a.k.a. arrays) new and delete.

The Borland C++ runtime library routine _vector_new() is called to
allocate arrays of objects having constructors.  _vector_delete() is
called to deallocate arrays of objects having destructors.  These two
routines eventually call _new() and _delete() to do the actual memory
allocations.

The statements

   char str[80] = new char[80];
   delete [] str;

allocate and free an array of chars.  There are no constructor or
destructor methods to be called.

The statements

   myClass stuff[5] = new myClass[5];
   delete [] stuff;

are handled via the vector new and delete functions.  The myClass objects
presumably have constructors and destructors that need to be called.

You're getting a NULL pointer assigment error if you try

   delete stuff;

(the array [] brackets are omitted) probably because vector new & delete
saves the number of objects in the array by modifying the memory pointer
value returned by the basic new() and delete().



-- 
// rkinder@holonet.net            International Software Solutions, Inc.  -
// Robert J. Kinder, Jr.                             Boca Raton, Florida  -
//                                                        1-800-788-4774  -
// "We're having a real Ted Bundy day here." - C. Bernholtz
From: grossjoh@petty.ls6.informatik.uni-dortmund.de (Kai Grossjohann)
Newsgroups: comp.lang.c++
Subject: basic question
Date: 20 Nov 92 19:22:07
Organization: Universitaet Dortmund, Lehrstuhl Informatik VI
Distribution: world
Reply-To: Kai Grossjohann <grossjoh@ls6.informatik.uni-dortmund.de>
NNTP-Posting-Host: petty

Hi all, 


this has GOT to be a FAQ, but I ask anyway: Suppose I have:

	int i;
	for ( i=0; i<10; i++ ) {
		cout << "Hey, you!" << endl;
	}

After the loop, can I _rely_ on the fact that i==10? I mean, what does the
language specification say? I really don't want to do anything that's not
allowed here, but I hesitate to write

	int i; int j;
	j = 0;
	for ( i=0; i<10; i++ ) {
		cout << "Hey, you!" << endl;
		j++;
	}

and then use the fact, that after the loop, j==10.

What do you think?

Thanx for your help?

	-- Kai
--
--
  Kai Grossjohann            Phone (voice): 49 231 75 30 15
  Baroper Str. 331 App. 510  E-Mail: 
  W-4600 Dortmund 50         grossjoh@ls6.informatik.uni-dortmund.de
  Germany                    
--
There are two ways to solve this problem: the hard way, and the
easy way. Let's start with the hard way.
                        -- W. Schneider, from a Physics lecture
Newsgroups: comp.lang.c++
From: gthkoh@ntuix.ntu.ac.sg (Koh Thong Hwee)
Subject: Re: BC++ Container Class Problem
Organization: Nanyang Technological University - Singapore
X-Newsreader: TIN [version 1.1 PL7]
Date: Mon, 23 Nov 1992 07:32:21 GMT

Koh Thong Hwee (gthkoh@ntuix.ntu.ac.sg) wrote:
:   ... <other stuff deleted>
: 
: In particular, I would like to know how to use the link list to store
: disparate objects.  I can use the indirect storage method of storing their
: pointers instead.  However I need to declare the type T for the link list
: template class and how do I declare it for storing the different pointer types
: to the many different kinds of objects? 
: 

Thanx to all those who replied, in particular, to Ed Barton & Lee Sailer.

You are right in that these disparate objects do share something in common.
I have look through the disparate objects that are to go to the link list
and I can group them into 2 classes.  These 2 base classes do not have common 
traits between them except that they are used together in a common process.
So it seems that all my disparate objects will have to be derived from them.
In that case I will probably need 2 link lists then.

On the other hand, maybe I can still tie them together by abstracting from
them a "ProcessID" to create the topmost base class.  But how useful is 
this?  Considering that other than this ProcessID data member in this base
class, there is no other common data or function members.  Any pointer
from this base class, TBase*, will not be able to access the other members
from the next lower derived classes which have more members that I need
access to.  Furthermore I cannot convert the base pointer to that of any
of the 2 lower-level derived classes, even by explicit typecasting:

    TBase*   ptrBaseClass;
    (TDerived*)ptrBaseClass -> DerivedClass_fn();     //not legal is it?

(        TBase   ----->   TDerived
         {                {   ...
            ...               DerivedClass_fn();
         }                    ...
                          }
)

So it seems that I should stick to the first option of 2 base classes
with 2 link lists...

Any comment on this?


TH Koh
gthkoh@ntuix.ntu.ac.sg

Newsgroups: comp.lang.c++
From: rad2r@uvacs.cs.Virginia.EDU (Robert DeLine)
Subject: Does anyone understand this quirk?
Organization: University of Virginia Computer Science Department
Date: Tue, 17 Nov 1992 07:36:03 GMT


For your amusement, please consider the following little program:


     #include <iostream.h>
     
     class A
     {
       public:
         A ()  { this->id(); }
         virtual void id () const {  cout << "A\n"; } 
     };
     
     
     class B : public A
     {
       public:
         B () : A() { }
         virtual void id () const {  cout << "B\n"; }
     };
     
     
     main ()
     {
         B* bptr = new B();
     }



The output I get from three different compilers is "A", but I was
expecting to see "B".  Does a virtual function not become virtual till
after the constructor is done?  What gives?  Is it my compilers or is
this a bug in the language definition itself?  (Or is it just me? :)

Many thanks,

Rob DeLine
Computer Science, University of Virginia
deline@Virginia.EDU
Newsgroups: comp.lang.c++
From: frank@Cookie.secapl.com (Frank Adams)
Subject: Re: Just what is so great about streams?
Date: Tue, 17 Nov 1992 23:10:38 GMT
Organization: Security APL, Inc.

In article <KANZE.92Nov17192153@slsvdnt.us-es.sel.de> kanze@us-es.sel.de (James Kanze) writes:
>In article <1992Nov14.014733.534@frumious.uucp> pat@frumious.uucp
>(Patrick Smith) writes:
>|> kanze@us-es.sel.de (James Kanze) writes:
>|> |Does anyone know of a better way of handling IO formatting in a
>|> |type-safe, extensible manner.  It's too late to change the iostream
>|> |syntax, but I am curious as to what the alternatives are.
>
>|> I've always thought it would be nice to be able to write
>|> something like
>
>|>    int i = 20, j = 17;
>|>    cout["i = %d, j = %d\n"] << i << j;
>
>This is great.  The really nice thing about it is that it is a natural
>extention to the current streams library; it doesn't break anything
>and it doesn't really add still another idiom.  I'd probably put the
>format string in parentheses, though, and overload the operator(), but
>that's just nit-picking.
>
>What is really nice is that it can do automatic type conversions,
>which even printf couldn't, ie:
>
>	cout( "i = %f , j = %f\n" ) << 0 << 1 ;
>
>Typically, once I got used to printf, the only place I regularly
>fouled up is when I had a variable with the format (which was the same
>for a number of printf's), and at some point, wanted to use a constant
>(like 0) instead of a variable.  Inevitably, I'd forget that it had to
>be 0.0.
>
>Here, of course, the overloaded operator( fmtstream& , int )
>recognizes that the requested format is %f, converts the int to
>double, and passes it to operator( fmtstream& , double ).

I agree entirely (including that it should be () instead of []).  One
addition to printf formats should be made: a format code which accepts an
object for formatting (using the standard formatting for the object).
Perhaps %g could be extended for this purpose.

I particularly like the fact that this is just a library extension, not a
language extension.

It would be nice to find some way to extend it to support different
formatting codes for class objects.  I think this is doable.
Newsgroups: comp.lang.c++