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: <1639@enea.UUCP> Date: Mon, 12-Jan-87 17:59:22 EST Article-I.D.: enea.1639 Posted: Mon Jan 12 17:59:22 1987 Date-Received: Tue, 13-Jan-87 05:07:55 EST References: <1634@enea.UUCP> <594@mcgill-vision.UUCP> Reply-To: sommar@enea.UUCP (Erland Sommarskog) Organization: ENEA DATA Svenska AB, Sweden Lines: 36 In article <594@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes: >In article <1634@enea.UUCP>, sommar@enea.UUCP (Erland Sommarskog) writes: >> 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. > >NO. The compiler does not treat scanf(), printf(), etc, any >differently from any routine which is defined in another file. They >are "standard" only in that (almost) all environments which support C >also support these routines. Pascal, on the other hand, does things >for write(), writeln(), etc, differently from the way it handles calls >to user routines. There's been some people telling me same thing by mail. And, OK, I was wrong in my statement that a C compiler recognizes the standard routines. But on the other hand I never meant to claim that as a fact, but merely that the compiler COULD (and should) recognize them. It is completely possible to put that in the compiler, isn't it. The question whether the fact that no existing C compiler actually does this means that all compilers are stupid or that there is an error in the language defition is more of semantical nature which I am not going to discuss. 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. 2) Introduce a syntax that allows this. Possible, but not very attrcative. 3) Skip checking of parameter count. To be straight: Ridiculous. 4) Forget the whole thing. If anyone has any more objections against me at this particular point which are directly related to C, I think he may as well keep them for himself. I'd like to regard this as a general debate, not as a particular C issue.