Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!enea!sommar From: sommar@enea.UUCP (Erland Sommarskog) Newsgroups: comp.lang.misc Subject: Re: Check the Arg Count Message-ID: <1634@enea.UUCP> Date: Tue, 6-Jan-87 17:31:10 EST Article-I.D.: enea.1634 Posted: Tue Jan 6 17:31:10 1987 Date-Received: Wed, 7-Jan-87 02:58:17 EST References: <3395@amd.UUCP> <4886@mimsy.UUCP> <3101@diamond.Diamond.BBN.COM> <3208@milano.UUCP> <23508@rochester.ARPA> Reply-To: sommar@enea.UUCP (Erland Sommarskog) Organization: ENEA DATA Svenska AB, Sweden Lines: 32 In article <23508@rochester.ARPA> ken@rochester.UUCP (SKY) writes: > >Varargs: there have been several proposals for the specification syntax >of varargs. I would be interested if any real language has implemented >one. Well, VAX-pascal has something like that. If you declare: PROCEDURE Alice( Param1 : A_type; (. List .) Varargs : Some_other_type); You can call Alice with for instance: Alice(A_type_value, Some_other_type_value1, Some_other_type_value2, ... etc if you like); VAX-pascal offers you standard routines to find out many you really did provide. The restriction is that Varargs must be the last parameter and of course all must of the same type as far as I can see. I never used this feature myself. (If any one wonders: VAX-pascal is quite a large language which happen to standard pascal as a true subset.) Ada does not allow this, however I think that array aggregates would fit extremely well for the purpose. If you want a general Max routine you declare: TYPE Element_array IS ARRAY (<> RANGE integer) OF Your_favourite_type; PROCEDURE Max(Elements : Element_array) IS...END Max; and then you call Max_value := Max((1,2,3)); To comment the debate in general I must I don't understand it. Saying that a C compiler shouldn't check for correct numbers of procedure parameters, just because printf() and scanf() accepts variable parameters lists makes no sense. These are standard routines aren't they? Thus the compiler do recognize them.