HDTenEightyP/NetNews huggingface dataset:
From: krauskop@en.ecn.purdue.edu (Curtis D Krauskopf)
Subject: Re: New Employee Test
Summary: My employee test in C
Organization: Purdue University Engineering Computer Network
Date: Thu, 19 Nov 92 00:27:24 GMT

I run a database programming company.  My favorite interview questions 
ask the candidate how a bubble sort works.  Later in the interview,
I ask the candidate to "write a C function to bubble sort an array of
integers on paper, and tell me how long you think it will take".  It
is the candidate's responsibility to ask about the parameters of the
function, the return value, whether the sort should be ascending or
desending, how many integers are in a typical array.... etc.  Any 
reasonable question, regardless of its nature, is a bonus point.
Suggestions that a quicksort or other algorithm be used (especially
since quicksort is a standard library function) get many bonus points.
If the candidate asks, they can have full access to the company library
of C books.  (I don't believe in closed-book tests, especially on-the-job).

When the candidate returns with the answer, I have them desk-check a
bubble sort function that has some bugs in it.  I tell them that the
function compiles, but it doesn't work right.   I also have them 
rewrite the function so that it runs more quickly (the function uses
a brute-force bubble sort with an off-by-one error in the two loops
and it calls a function called swap() to swap the two integers).

Now granted, it isn't every day that a programmer writes a bubble sort,
but I've been amazed at how much this sequence of questions has told me
about a programmer's ability, their systems analysis experience, their
ability to communicate technical issues, and their awareness of details
behind how a languges operates.  

I do not dock the candidate too many points for not knowing or remembering
how a bubble sort works.  Once I explain it to them, though, I would expect
them to be able to write the function.  I also take into consideration
whether the candidate has any 'real-life' work experience when evaluating
the questions (or lack thereof) when the candidate asks about the function.

Although my example isn't in C++, I think you could arrange it to be a 
C++ program, maybe even having the candidate create a class to bubble 
sort integers.

Curtis
From: mharriso@digi.lonestar.org (Mark Harrison)
Newsgroups: comp.lang.c++
Subject: Re: Idempotent header file proposal
Date: 23 Nov 92 15:35:27 GMT
Organization: DSC Communications Corp, Plano, TX

In article <1992Nov19.221907.4801@lucid.com>
jss@lucid.com (Jerry Schwarz) writes:

>In article <1992Nov19.090742.23696@cbfsb.cb.att.com>,
>nh@cbnewsg.cb.att.com (nicholas.hounsome) writes:
>|> Of course I know that there is the crude workaround :
>|> 
>|> #ifndef HEADER_H
>|> #define HEADER_H
>|> 
>|> stuff
>|> 
>|> #endif
>|> 

>Some compilers/preprocessor recognize this construct in the header,
>remember it, and don't even reopen the file when HEADER_H is #defined at
>the point of the #include. 
>
>I suggest you push your vendor to do this intelligent optimization 
>rather than asking for a #pragma.
>
>   -- Jerry Schwarz

Jerry is too modest to say so, but Lucid's compiler does this.
I traced the command line version "lcc" to verify that the
documentation was telling the truth. :-)
-- 
Mark Harrison, mharriso@dsccc.com     Please double check the return address
                                      in the header... It may not be right.
                                      The problem is being worked on.
Newsgroups: comp.lang.c++,comp.std.c++
From: gjditchf@plg.uwaterloo.ca (Glen Ditchfield)
Subject: Re: Proposal - enhancement for switch statement.
Organization: University of Waterloo
Date: Mon, 23 Nov 1992 14:40:18 GMT

In article <9232811.8739@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
>Perhaps a good way to indicate that the fallthrough is deliberate would be to
>use an explicit goto.
>	switch(x) { ...
>		case 2:	...
>			goto case_3:	/* fall through */
>		case_3:			/* [Note the "_"!] */
>		case 3:	...
>	}
>
>Any half-decent compiler will of course be able to optimize out the goto.
>It is still irritating that you are not allowed to jump to case labels,

If I remember correctly, the Plan 9 C compiler does allow "goto case 3"
(that is, with no underscore).
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c++
Subject: Re: New Employee Test
Date: 22 Nov 92 14:38:29 GMT
Article-I.D.: alice.24271
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Murray Hill NJ

In article <1992Nov21.112718@IASTATE.EDU> kv07@IASTATE.EDU (Warren Vonroeschlaub) writes:

>   I thought I would mention that, at least it in New York, it is illegal to give
> a test to prospective employees before hiring them.

I was windering how long it was going to take this to turn up.

In the good old days, when Bell Labs was actually hiring people,
I was given a thing called the `Recruiter's Handbook' to read.

If I remember correctly, it said that any kind of skill test in an
employment interview was a violation of Federal law unless the test
had been proven to be non-discriminatory.

On the other hand, the handbook said that there was nothing wrong
asking questions like

	`Tell me about a programming problem you solved that you
	 found particularly interesting.'
-- 
				--Andrew Koenig
				  ark@europa.att.com
Newsgroups: comp.lang.c++
From: joslyn@kong.gsfc.nasa.gov (Cliff Joslyn)
Subject: Good C++ Magazine?
Organization: Goddard Space Flight Center
Date: Sat, 21 Nov 92 21:20:53 GMT

I've been a loyal subscriber to the /C User's Journal/ for a while,
but I'm moving into C++ completely, and honestly it's a bit behind me
now. I enjoy the C++ column, but want a C++ only magazine. I got a C++
Newsletter for a while, but it was really expensive.

Is there anything out there?

Thanks.

O----------------------------------------------------------------------------->
| Cliff Joslyn, Cybernetician at Large, 327 Spring St #2 Portland ME 04102 USA
| Systems Science, SUNY Binghamton      NASA Goddard Space Flight Center
| cjoslyn@bingsuns.cc.binghamton.edu    joslyn@kong.gsfc.nasa.gov
V All the world is biscuit shaped. . .
Newsgroups: comp.lang.c++
From: sbgros@skcla.monsanto.com
Subject: biosequip()
Organization: Searle, Skokie, IL
Date: Fri, 20 Nov 1992 13:09:18 GMT

Hello,

  I'm looking for someone who is using B. Turbo C++ > 1.0
I would like to know about the biosequip()  could someone
send me the current bit list.  I'm using 1.0 and for the RAM
memory it only goes to 64K.  I will be getting version 3.5 soon
but not soon enough. I would like to get ahead a bit.

thanks

scott

sbgros@monsanto.com
Newsgroups: comp.lang.c++
From: srheintze@happy.colorado.edu
Subject: Wanted: Real Example of MI
Organization: University of Colorado, Boulder
Date: 19 Nov 92 10:12:10 MDT

I am revising a course on C++.  I have been looking for some examples of
multiple inheritance for some time now.  I look thru the plethora of C++ books
at the local book stores and so far, I have yet to encounter one that has a
good example of multiple inheritance.

Most of the x+++

I am revising a course on C++.  Specifically I want to enhance the section on
multiple inheritance (MI) and I am having trouble comming up with appropriate
examples. The only examples I can think of require a lot of domain knowledge. I
regularly peruse the plethora of C++ books at the local book stores and have
yet to find a satisfactory example of MI (Apparently others are having a
difficult time of MI examples too). Most of the examples are	either

	purely syntactic (e.g.: class D: public B1, B2{...};)  	

	or semantically non-sensical (e.g.: class TimeStamp : public
	Clock, public Date{...};). 	

	or trivial (class Panda : public Racoon, public Bear {...};)
	Give me a real example of when this would be used in a real
	application! If it was an application for a Zoo database,
	feeding times, feeding amounts and other
	requirements (i.e., data members and function
	members) would
	not be inherited from Raccoons and Bears. 
	(See Tom Cargill's Book "C++ Programming
	Style" for a good discussion of this common flaw - page
	212).

Can any one give me a reasonable example of MI that is
semantically consistent, concise and short AND REAL? 	

	Thanks,	
			Sieg
Newsgroups: comp.lang.c++
From: mcgrant@rascals.stanford.edu (Michael C. Grant)
Subject: Re: Proposal - enhancement for switch statement.
Organization: Information Systems Laboratory, Stanford University
Date: 15 Nov 92 13:27:47

In article <1992Nov15.190830.11622@cssc-syd.tansu.com.au>
pete@cssc-syd.tansu.com.au (Peter Alexander Merel) writes:
   Before I describe what occurred to me, yes folks I know that a switch is not
   as useful as a virtual function.
   But what I'd like for a snippet I'm working on at the moment would be for
   switch to use operator== rather than relying on conversion to int, so that 
   I could use it to test cases on objects rather than building an industrial 
   strength if statement. 
   And no, the class in question won't go onto int.
   This should be language compatible with the C usage, and not too hard
   for translaters to do just by translating into the aforementioned 
   industrial if.
   Any chance?

I doubt it... Even before C++ came along, switch statements could not
handle floats, strings, structures, etc. Sure, a switch statement could
be turned into a set of if-then-else statements, but it isn't because
it usually is best turned into a jump table.

I wouldn't object to such an addition in principle, except for the fact
that it's unnecessary (a big objection for sure).

Michael C. Ggrant
From: iotov@ccsf.caltech.edu (Mihail Iotov)
Newsgroups: comp.lang.c++
Subject: operator overloading
Date: 20 Nov 1992 04:55:12 GMT
Organization: CCSF Caltech, Pasadena, CA
Distribution: world
NNTP-Posting-Host: pollux.ccsf.caltech.edu

 

I am trying to overload some operators this way

set&   set::operator= (const set& s) ;

set  set::operator* (const set& s) 
{
  set   product ;
  [do something]
  return product ;        /* this line is 88 */

}
and I get form g++ :

set.cxx: In method class set set::operator * (const class set &):
set.cxx:88: warning: bitwise copy: `set' defines operator=()

Shouldn't the assignment method be called for the return operation ?


Thanks, 
	Mihail
Newsgroups: comp.lang.c++
From: erict@ascent-west.uucp (Eric Tiffany)
Subject: Re: New Employee Test
In-reply-to: kv07@IASTATE.EDU's message of Sat, 21 Nov 1992 17:27:18 GMT
Organization: Ascent
	<gregc.722224296@eagle.fsl.noaa.gov> <641@ulogic.UUCP>
	<1992Nov21.112718@IASTATE.EDU>
Date: 23 Nov 92 09:17:23


In article <1992Nov21.112718@IASTATE.EDU> kv07@IASTATE.EDU (Warren
Vonroeschlaub) writes:

    I thought I would mention that, at least it in New York, it is
    illegal to give a test to prospective employees before hiring
    them.

Interesting.  JYACC (in NYC), the maker of JAM and other UNIX
development tools, gives a programming test to everyone who comes in
the door.  I wonder if this law is still in force, or if JYACC knows
about it.



--
      ________________________________________________________________________
     /                          /    \            /    /                     /
    / Eric Tiffany             /  / \<_  /     _|\\/  /   Ascent Technology /
   / 312 Briarcliff Drive So. / /\\  \  /\   /\\  \\//    64 Sidney Street / 
  / Ossining, NY  10562      / \\/\\/ /\  \ \\ \\   / Cambridge, MA 02139 /  
 / (914) 944-9003           / \/\\    \/\  \/\\/   /      (617) 225-0850 /   
/__________________________/___\_______\____\_____/_____________________/    
			   erict@ascent.com
			...!uunet!ascent!erict
From: pete@cssc-syd.tansu.com.au (Peter Alexander Merel)
Newsgroups: comp.lang.c++
Subject: Proposal - enhancement for switch statement.
Summary: switch could be painlessly beefed up
Date: 15 Nov 92 19:08:30 GMT
Organization: AOTC - CSSC

Before I describe what occurred to me, yes folks I know that a switch is not
as useful as a virtual function.

But what I'd like for a snippet I'm working on at the moment would be for
switch to use operator== rather than relying on conversion to int, so that 
I could use it to test cases on objects rather than building an industrial 
strength if statement. 

And no, the class in question won't go onto int.

This should be language compatible with the C usage, and not too hard
for translaters to do just by translating into the aforementioned 
industrial if.

Any chance?

-- 
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.
Newsgroups: comp.lang.c++
From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
Subject: Re: Unhandled exception error in BC++3.1
Date: Mon, 23 Nov 1992 18:39:40 GMT
Organization: University of Birmingham

In article <wai.722433923@csuvax1>, wai@csuvax1.csu.murdoch.edu.au (Julian Wai) writes:
> 
> Hi,
> 
> Does anyone know what the following error mean ?  Any suggestions will be
> appreciated.
> 
> 
> ----------------------------------------------------------------------------
> 
>         UNHANDLED EXCEPTION 0D at 00B7:229A Error code: 034C
> 
>          AX = 000D   BX = 0000   CX = 0148   DX = 0050
>          SI = 0057   DI = 0045   BP = 0FE2   SP = 0FDA
>          CS = 00B7   Limit =240F
>          DS = 00BF   Limit =219F
>          ES = 00BF   Limit =219F
>          SS = 005B   Invalid segment
>          - 00B7:2292   3D 1E 06 2E 8E 1E 05 00  FF 1E 87 21 07 1F 5F CF
> 
>          You may hit [T] to terminate, but you should reboot as soon as possible,
>          as the system is unstable ...t
>          Unhandled exception 000D at 00B7 229A ErrCode 034C  
> 
> 
> 
> Thanks in advance.
> 
> Julian
> wai@csuvax1.csu.murdoch.edu.au 
"Segmentation fault - core would be dumped if you had a real operating system
but since this is DOS your whole system is about to come crashing down
around you" --- or at least that's how I've always read it! 
-- 
    \\   ( )    No Bullshit!     |  Email: B.A.McCauley@bham.ac.uk   
 .  _\\__[oo        from         |  Voice: +44 21 471 3789 (home)
.__/  \\ /\@    /~)  /~[   /\/[  |    Fax: +44 21 625 2175 (work)
.  l___\\      /~~) /~~[  /   [  |  Snail: 197 Harborne Lane,
 # ll  l\\    ~~~~ ~   ~ ~    ~  |         Birmingham, B29 6SS, UK
###LL  LL\\   (Brian McCauley)   |   ICBM: 52.5N 1.9W
Newsgroups: comp.lang.c++
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: inline functions with static local variables (was: Re: Wisdom on f(...,const class& xxx = default_xxx))
Organization: Computer Science, University of Melbourne, Australia
Date: Mon, 23 Nov 1992 01:49:11 GMT

steve@taumet.com (Steve Clamage) writes:

>(because an inline function can't have static local variables).

Why not?
Is there any restriction on this in the ARM? I couldn't see anything
in C++PL 2nd Ed.

g++ will quite happily go ahead and inline such functions.

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
Newsgroups: comp.lang.c++
From: ftandiar@IASTATE.EDU (Fredy Tandiary)
Subject: FAQ for c++
Reply-To: ftandiar@IASTATE.EDU (Fredy Tandiary)
Organization: Iowa State University
Date: Thu, 19 Nov 1992 18:24:12 GMT


Hi, I wander if there is a current FAQ for c++ and c ?


ftandiar@iastate.edu
Newsgroups: comp.lang.c++
From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
Subject: Re: Using *new* safely
Date: Thu, 19 Nov 1992 13:23:41 GMT
Organization: University of Birmingham

In article <bruceb.722124804@babel.cltr.uq.oz.au>, bruceb@ctpm.uq.oz.au (Bruce Blackshaw) writes:
> I'm interested in how to safely use the new operator in the constructor of
> a complex object - if you are dynamically allocating the instance of a class
> that itself dynamically allocates in its constructor, how do you stop crashes
> due to failure of new?

Throw and exception in your new_handler. The example you cite is probably
most important reason for the introduction of exeption handling.

If you don't have exception handling yet my advice is wait - it will
probably take as long for you to solve the problem without exceptions
as it will for your compiler to catch up!
-- 
    \\   ( )    No Bullshit!     |  Email: B.A.McCauley@bham.ac.uk   
 .  _\\__[oo        from         |  Voice: +44 21 471 3789 (home)
.__/  \\ /\@    /~)  /~[   /\/[  |    Fax: +44 21 625 2175 (work)
.  l___\\      /~~) /~~[  /   [  |  Snail: 197 Harborne Lane,
 # ll  l\\    ~~~~ ~   ~ ~    ~  |         Birmingham, B29 6SS, UK
###LL  LL\\   (Brian McCauley)   |   ICBM: 52.5N 1.9W
Newsgroups: comp.lang.c++
From: sjm@bcrki65.bnr.ca (Stuart MacMartin)
Subject: Re: Just what is so great about streams?
Organization: Bell-Northern Research Ltd., Ottawa, Canada
Date: Mon, 23 Nov 1992 14:32:56 GMT

In article <7011@taurus.cs.nps.navy.mil> skip@taygeta.oc.nps.navy.mil (Skip Carter) writes:
>In article <1992Nov18.134551.5782@bcrka451.bnr.ca>, sjm@bcrki65.bnr.ca (Stuart MacMartin) writes:
>|> 
>|> What about     fout << t << t << endl;   
>|> The wrong operator<<() will be called for the second output unless you provide
>|> the appropriate friend function for TimeStamp, no?
>|> 
>
>	There is no problem at all with      fout << t1<< t2 << endl;
>	Since  the evaluation order is:
>	first,
>		fout << t1;	
>
>	which returns a reference to fout which  is then used in the operation,

I think my example was faulty.
                fout << "The first is " << t1 << " and the second is " << t2 << endl;

If operator<<() is overloaded and a friend function is provided for char * but not
for TimeStamp, then (fout << "The first is") returns a reference to fout as a Message,
but (... << t1) returns a reference to fout as an ostream.  Thus the operator<< used
for " and the second is " is the ostream& one, not the Message& one.

As has been stated many times, everything is ok so long as you don't try to overload
operator<<.  Otherwise, a friend function has to be defined for every class that
might be output.

A few people have claimed in private messages to me that although operator<< is
not virtual, the things it uses are virtual, so I ought to be able to define a
class to do what I want to do without overloading operator<<.  I hope they're right.

Stuart
--
: Stuart MacMartin                                    email: sjm@bnr.ca      :
: Bell-Northern Research                              phone: (613) 763-5625  :
: PO Box 3511, Stn C, Ottawa, K1Y-4H7, CANADA    Standard disclaimers apply. :
Newsgroups: comp.lang.c++
From: kanze@us-es.sel.de (James Kanze)
Subject: Re: Two things: typeof() and exceptions
Organization: SEL
	<1992Nov16.202036.1@vax1.bham.ac.uk>
Date: 18 Nov 92 15:43:11

In article <1992Nov16.202036.1@vax1.bham.ac.uk>, Brian McCauley
writes:

|> > Secondly, I was reading the reference manual for Dylan (Apple's new OO
|> > language) and I noticed something that was pretty hot in the exception-
|> > handling domain. Basically, in any given procedure you can define a set
|> > of instructions that are guaranteed to be executed even if the rest of
|> > the procedure is terminated early due to an exception. Currently in C++,
|> > automatic variables are destroyed as the stack is unwound. But, with 
|> > a set of 'unwind' statements in a function, I could destroy all of the
|> > variables I allocated on the heap as well.

|> Yes? In C++ this is written thus:

|> void foo() {
|>   try { /* body of function */ }
|>   catch (...) { /* unwinding code */ throw; }
|> }

|> I'm sure the answer to your question can't be that simple so perhaps
|> you'd better explain again.

I don't know what Dylan does, but Modula-3 has a finally clause in
addition to a catch for a try block.

The difference is: a catch clause is only executed if an exception is
thrown.  If it is used for ressource clean-up, then the clean up code
must be duplicated outside of the catch clause.  A finally clause is
executed whether or not an exception is thrown, so it is sufficient to
put any clean-up code there.  (It also rethrows any exception
automatically, so the "throw" isn't necessary either.)

Would there be any support for adding a finally clause to C++.  It's
not likely to break any existing code, since it is a pure extension
(to exceptions, no less; how many people are actually using exceptions
at this time, as opposed to the number who wish they could?).  Except
for the new keyword, I don't see anything that it could break (just
offhand, I haven't done any real analysis).

I know that the same effect can be obtained by declaring anything
requiring clean-up as a class, and doing the clean-up in the
destructor, but I'm not sure that this is always the most appropriate
idiom.
--
James Kanze			GABI Software, Sarl.
email: kanze@us-es.sel.de	8 rue du Faisan
				67000 Strasbourg
				France
Newsgroups: comp.lang.c++
Subject: Thank you! was "Can someone please help me with streams?"
From: ECSC9120802J@LUST.LATROBE.EDU.AU (GRANT,David)
Date: Sat, 21 Nov 1992 13:39:52 GMT
Organization: La Trobe University
X-News-Reader: VMS NEWS 1.24

This is just a quick thankyou to all of the people that mailed me and helped me
with my program. I've got it working now. Thanks again.
			
					David.

----------------------------------------------------------------------------
David Grant		            |  "No one would suurender to the 
"The Dread Pirate Roberts"          |   Dread Pirate Westly"
ecsc9120802j.lust.latrobe.edu.au    | 		 - The Princess Bride.
or  9120802j.lux.latrobe.edu.au     |  P.S "La domo estas bela!"
----------------------------------------------------------------------------
Newsgroups: comp.lang.c++
From: pickerig@eee.bham.ac.uk (Guy Pickering)
Subject: Re: Using *new* safely
Date: Thu, 19 Nov 1992 10:15:28 GMT
Organization: The University of Birmingham, England
X-Newsreader: TIN [version 1.1 PL6]

Bruce Blackshaw (bruceb@ctpm.uq.oz.au) wrote:
: I'm interested in how to safely use the new operator in the constructor of
: a complex object - if you are dynamically allocating the instance of a class
: that itself dynamically allocates in its constructor, how do you stop crashes
: due to failure of new?
: 
: 
: --
: ****************************************************
: Bruce Blackshaw bruceb@ctpm.uq.oz.au   
: "... I'd rather be hang gliding ..."
: ****************************************************

I add an isOk() function, and keep the status in the class, when all
allocation is complete, is set the is_ok flag to TRUE. Then after
construction, I can call isOk() to see if all went well.

The ultimate way to do it is to use exceptions, but if you don't
have exceptions provided by your compiler...

Guy

--
+--------------------------------+-----------------------------------------+
| Guy Pickering                  | School of Electronic & Electrical Eng,  |
| E-MAIL: G.PICKERING@uk.ac.bham | University of Birmingham,               |
| Tel: (021) 414 4340            | Edgbaston, Birmingham. B15 2TT.         |
+--------------------------------+-----------------------------------------+
| "I have ten pairs of trainers...One for each day of the week" - Sam Fox  |
+--------------------------------+-----------------------------------------+


Newsgroups: comp.lang.c++