[misc.jobs.offered] 1000 lines of C a week?

sc2y@vax5.CIT.CORNELL.EDU (06/12/89)

In article <15526@pollux.UUCP> leff@smu.edu (Laurence Leff) writes:
>A project needs a person with a proven capability of generating
>a thousand lines of debugged C a week.  

Okay, how about this?
  
   /* compute square root of a number if less than 1000 */
   float comp_sqrt(x)
   int x;
   {
    if (x  == 1)
      return (sqrt(x));
    else if (x == 2)
      return (sqrt (x));
    else if (x == 3)
      return (sqrt (x));
    /* ... et cetera ... */
    else if (x == 999 )
      return (sqrt (x)) ;
    else
      return (ERROR) ;
   }
     
Do I get the job?

Tim_CDC_Roberts@cup.portal.com (06/13/89)

In <18783@vax5.CIT.CORNELL.EDU>, sc2y@vax5.cit.cornell.edu asks with
  tongue in cheek:

>>A project needs a person with a proven capability of generating
>>a thousand lines of debugged C a week.  
>
>Okay, how about this?
>  
>   /* compute square root of a number if less than 1000 */
>   float comp_sqrt(x)
>   int x;
>   {
>    if (x  == 1)
>      return (sqrt(x));
>     ....
>     
> Do I get the job?

Since you didn't declare "double sqrt (double)", and you are passing an int 
to a function expecting a double, and returning a double for a function
that is supposed to return a float, this function will fail on any machine 
where sizeof(int) != sizeof(double) or sizeof(float) != sizeof(double). 

Since the specifications clearly called for "a thousand lines of DEBUGGED
C a week", you obviously do NOT get the job.  Sorry.  I hear McDonalds is
hiring.

Tim_CDC_Roberts@cup.portal.com                | Control Data...
...!sun!portal!cup.portal.com!tim_cdc_roberts |   ...or it will control you.

 

fozzard@boulder.Colorado.EDU (Richard Fozzard) (06/15/89)

>In article <15526@pollux.UUCP> leff@smu.edu (Laurence Leff) writes:
>>A project needs a person with a proven capability of generating
>>a thousand lines of debugged C a week.  
>


Enclosed is my resume:

{
	;
	;
	;
/* 994 lines removed for clarity */
	;
}


Do I get the job?


========================================================================
Richard Fozzard					"Serendipity empowers"
University of Colorado			
fozzard@boulder.colorado.edu                   (303)492-8136 or 444-3168

mouse@mcgill-vision.UUCP (der Mouse) (06/27/89)

In article <19436@cup.portal.com>, Tim_CDC_Roberts@cup.portal.com writes:
> In <18783@vax5.CIT.CORNELL.EDU>, sc2y@vax5.cit.cornell.edu asks with
>   tongue in cheek:
>>> A project needs a person with a proven capability of generating a
>>> thousand lines of debugged C a week.

>> Okay, how about this?
>>   /* compute square root of a number if less than 1000 */
>>   float comp_sqrt(x) int x; {
>>    if (x  == 1)
>>      return (sqrt(x));
>>     ....

> Since you didn't declare "double sqrt (double)",

If we're being picky, he also didn't say the code he exhibited was the
entire file: it could have been just one routine extracted from a file
which quite possibly had a line "#include <math.h>" above the sample.

> and you are passing an int to a function expecting a double, and
> returning a double for a function that is supposed to return a float,
> this function will fail on any machine where sizeof(int) !=
> sizeof(double) or sizeof(float) != sizeof(double).

Actually (under the assumptions you made, ie, no declarations), it
requires more than just that int and double have the same size - it
also requires that for all values 1 to 999, the bit patterns are
identical and are passed to sqrt() in the same way.  (I expect this
excludes all existing C compilers.  I certainly *hope* it does!)

The "returning a double when supposed to return a float" is specious:
return values have always been cast to the proper type for the
function, even in Classic C.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu