Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-lcc!unisoft!jef
From: jef@charming.uucp (Jef Poskanzer)
Newsgroups: comp.lang.misc
Subject: Re: Check the Arg Count
Message-ID: <193@unisoft.UUCP>
Date: Tue, 30-Dec-86 16:24:19 EST
Article-I.D.: unisoft.193
Posted: Tue Dec 30 16:24:19 1986
Date-Received: Tue, 30-Dec-86 21:47:25 EST
References: <3395@amd.UUCP> <4886@mimsy.UUCP> <3101@diamond.Diamond.BBN.COM>
Sender: news@unisoft.UUCP
Reply-To: jef@charming.UUCP (Jef Poskanzer)
Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal
Lines: 73

In article <3101@diamond.Diamond.BBN.COM> rgenter@Diamond.BBN.COM (Rick Genter) writes:
>(1) Bullshit.  Variable length argument lists are part of C.  C compilers
>    are COMPELLED to allow variable length argument lists.  Mike was referring
>    to C.
>
>(2) Bullshit.  How do you deal with printf(), scanf(), etc.?  In a single
>    compilation, it is a static property of the code that these routines
>    need to be called with variable numbers of arguments at different points
>    within the same program (or even the same routine).

(1) Bullshit.  Variable length argument lists are a very very small part
of C, but to accomodate them cc and lint throw out 90% of the useful
type checking that better languages do.  For example, try running the
appended program through lint.  I will be amazed if anyone has a lint that
complains about it.  In Mesa, it is very common to do this kind of
call-back programming, and the compiler catches errors of this type.

(2) Bullshit.  I found it very easy to write a printf-clone in Mesa.
I used variant records for the data, so that the compiler did most
of the type-checking work, and I got variable numbers of arguments
by using defaulting parameters.  No problem at all for a Real Man's
Language.

Besides, even if you naively believe that lint does a good job of
type-checking, the fact is that most people simply don't use it.
In fact, over half of the systems I program on don't even have lint
installed, and if I were to complain to the sysadmin, he'd tell me
they can't afford the space.  Separating type-checking out of the
compiler is an engraved invitation for bogosity.
---
Jef

			     Jef Poskanzer
		    unisoft!jef@ucbvax.Berkeley.Edu
			 ...ucbvax!unisoft!jef
			     (415)644-1230

- - - - - - - - - -

% cat test.c
#include 

int
intfunc( intarg )
int intarg;
    {
    return ( 10 / intarg );
    }

int
floatfunc( floatarg )
float floatarg;
    {
    return ( (int) ( 10.0 / floatarg ) );
    }

int callit( func )
int (*func)( );
    {
    return( (*func)( 2 ) );
    }

main( )
    {
    printf( "callit( intfunc ) = %d\n", callit( intfunc ) );
    printf( "callit( floatfunc ) = %d\n", callit( floatfunc ) );
    }
% cc test.c -o test
% lint test.c
test.c:
% ./test
callit( intfunc ) = 5
Floating exception