Efficient coding considered harmful?

Dik T. Winter dik at cwi.nl
Fri Nov 25 11:36:43 AEST 1988


 > >	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? [:-)]

(For those who do not know, Algol 68)
 > 
 > OK, so what is the data type of
 > 
 > 	(i, c, "hello world")
 > 
 > Just adding extra brackets wouldn't have been sufficient; it leaves
 > questions such as that one....

It is an 'array display', i.e. the second parameter is an array whose
components are a union of a lot of things.  The extra brackets are
required as there is (in Algol 68) a difference between:
	print(a, b, c)
and
	print((a, b, c))
the first calls print with three parameters (which is illegal),
the second with only one.


-- 
dik t. winter, cwi, amsterdam, nederland
INTERNET   : dik at cwi.nl
BITNET/EARN: dik at mcvax



More information about the Comp.lang.c mailing list