Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.misc Subject: Re: Check the Arg Count Message-ID: <5064@mimsy.UUCP> Date: Wed, 14-Jan-87 01:58:20 EST Article-I.D.: mimsy.5064 Posted: Wed Jan 14 01:58:20 1987 Date-Received: Wed, 14-Jan-87 19:01:06 EST References: <1634@enea.UUCP> <594@mcgill-vision.UUCP> <1639@enea.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 35 In article <1639@enea.UUCP> sommar@enea.UUCP (Erland Sommarskog) writes: >To get I/O-routines (or whatever scanf() is) with variable parameter lists, >there seems to be four ways: >1) Make them standard routines recognized by the compiler. The best alter- > native. Specially in a small langauge like C. This is bad because it cannot be extended, not without hacking the compiler. >2) Introduce a syntax that allows this. Possible, but not very attrcative. This is `not very attractive' because it clutters up the syntax? >3) Skip checking of parameter count. To be straight: Ridiculous. This is bad because it does not do something that could be done, and that has proven worthwhile in similar cases. >4) Forget the whole thing. This is bad because it makes the language harder to use. I claim that the proper solution is 1 and/or 2: What is needed is a way of telling the compiler, `this routine takes arguments described by . . .' that is general enough to cover printf, scanf, execl, and so forth, yet simple enough so that new ones can be introduced as necessary, and so that the syntax is not unduly cluttered. The real problem is in conveying the `described by' part. System V lint has /*PRINTFLIKE*/ and /*SCANFLIKE*/ pragmas in its lint library, which takes care of printf and scanf and variants, but not execl. Would adding /*REPEATING*/ suffice? I cannot say. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: seismo!mimsy!chris ARPA/CSNet: chris@mimsy.umd.edu