parsing the format string at compile time...

Tim_CDC_Roberts at cup.portal.com Tim_CDC_Roberts at cup.portal.com
Sat Oct 14 06:30:31 AEST 1989


Regarding Modula-2 requiring the programmer to parse format strings:

C++ is very much like this, if you think about it.

   printf ("%d %s %d\n", 123, "What?", 456");

becomes:

   cout << 123 << ' ' << "What?" << ' ' << 456;

There are separate, overloaded definitions of the '<<' operator, each of
which knows how to format a particular type.

Ada kind of mixes the two.  You make a separate function call for each
item (like Modula-2), but they all have the same function name (thanks
to overloading).

  put (123);
  put (" ");
  put ("What?");  -- ...

Tim_CDC_Roberts at cup.portal.com                | Control Data...
...!sun!portal!cup.portal.com!tim_cdc_roberts |   ...or it will control you.



More information about the Comp.lang.c mailing list