parsing the format string at compile time...

Larry Miller lmiller at venera.isi.edu
Thu Oct 12 02:54:06 AEST 1989


In article <705 at nixbur.UUCP> jobrien at nixbur.UUCP (John O'Brien) writes:
>I'm looked a description of Modula-2 yesterday, and one of the things
>that struck me was its lack of a general purpose I/O function.  Instead,
>you have a collection of procedures which output one value of each type.
>Thus, where you would say in C:
>
>printf("This is an integer: %d\n", 6);
>
>you would need three procedure calls in Mod-2:
>
>writechar("This is an integer: ");
>writeint(6);
>writeln;
>
	Parsing the format string is so incredibly trivial
	that there can be no advantage of having to make
	separate function calls for each data type like this.
	Many implementations just code it in assembly
	language, giving even faster execution, but even coded
	in C directly, it's no more than a loop to look at
	each character in the format string, then switching on %.

Larry Miller				lmiller at venera.isi.edu (no uucp)
USC/ISI					213-822-1511
4676 Admiralty Way
Marina del Rey, CA. 90292



More information about the Comp.lang.c mailing list