Efficient coding considered harmful?

anw at nott-cs.UUCP anw at nott-cs.UUCP
Wed Nov 23 04:24:38 AEST 1988


In article <437 at auspex.UUCP> guy at auspex.UUCP (Guy Harris) writes:
>
>In fact, if prototypes had been there since Day 1 and had been the
>*only* way of declaring functions (this may perhaps have made the
>language too big for the PDP-11 to compile, I don't know - I'm not
	  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	Naw!  Let's see [PDP 11/44, V7]:

	$ ls -l /lib/c?
	-rwxrwxr-x   1 bin	system	   23924 May  7  1979 /lib/c0
	-rwxrwxr-x   1 bin	system	   35282 May 16  1979 /lib/c1
	-rwxrwxr-x   1 bin	system	   11632 Jul 11  1980 /lib/c2
	$ size /lib/c?
	/lib/c0: 20736+3172+11552 = 35460b = 0105204b
	/lib/c1: 30592+4674+1206 = 36472b = 0107170b
	/lib/c2: 10176+1440+2430 = 14046b = 033336b

	Plenty of room there for expansion, even with a 64K limit!

>saying that this would necessarily have been the best thing), and if
>"varargs" or "stdarg" had been the only permissible way of doing
>variable-length-argument-list functions, calling sequences where the
>callee, rather than the caller, could safely have been used (since the
>compiler could feel reasonably confident that if a function expects N
>arguments of particular types, it will be passed just such a list of
>arguments), and it has at least been asserted that on some machines,
>such calling sequences are faster (e.g., the debates over the "C" and
>"Pascal" calling sequences on 80*86 machines).

	Of course, the real solution to the "varargs" problem, not possible
in C because of the dead hand of history, is to use extra brackets, so that
every function has a fixed number of arguments:

		printf ("%d %c %s\n", (i, c, "hello world"));
			^...arg1...^, ^.......arg2........^

	Now, what language did I see that nifty idea in? [:-)]

-- 
Andy Walker, Maths Dept., Nott'm Univ., UK.
anw at maths.nott.ac.uk



More information about the Comp.lang.c mailing list