lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm trying to think of why I said 25 years. C89 was the first attempt at standardizing varargs, and it was tied up with prototypes. Prototypes are critical to passing args in registers, and previous varargs approaches seemed to depend on uniform stack arg passing or register allocation against an imaginary stack etc.

25 years was also "a long time ago" and in particular when I had multipass C compilers with the passes on separate floppies. This was not going to be a good time to argue for a significantly smarter compile-time.

Anyway, I think you're right. From memory, FORTRAN IV aka FORTRAN 66 had format specifiers but they were in FORMAT statements and compiled. So I guess BCPL had all the ingredients--inline string constants, tolerance of varargs, uh and a giant need to describe the arguments in some hacky way since the compiler had no type information anyway.

> if you have all the constraints C did 25 years ago, printf/scanf are reasonable.

C and printf have been around for at least 35 years (counting from the
appearance of the K&R book in 1978).

Also, printf formats in C derive from the ones in BCPL. See WRITEF in
        http://www.lysator.liu.se/c/clive-on-bcpl.html

BCPL was created in 1966; the BCPL book by Richards and Whitby-Strevens
dates from 1980 and I can't find an earlier document that describes WRITEF.