Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!ginosko!gem.mps.ohio-state.edu!apple!agate!shelby!csli!jkl From: jkl@csli.Stanford.EDU (John Kallen) Newsgroups: comp.lang.c Subject: Re: parsing the format string at compile time... Message-ID: <10677@csli.Stanford.EDU> Date: 15 Oct 89 03:01:06 GMT References: <705@nixbur.UUCP> <11262@smoke.BRL.MIL> <23054@cup.portal.com> Sender: jkl@csli.Stanford.EDU (John Kallen) Reply-To: jkl@csli.stanford.edu (John Kallen) Distribution: usa Organization: Center for the Study of Language and Information, Stanford U. Lines: 29 In article <23054@cup.portal.com> Tim_CDC_Roberts@cup.portal.com writes: !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. I don't want to be picky, but at least as far as Cfront 2.0, G++ 1.36.0 and Zortech C++ go, your C++ line would output: 12332What?32456 You probably want: cout << 123 << " " << "What?" << " " << 456; John. _______________________________________________________________________________ | | | | |\ | | /|\ | John K{llen "If she weighs the same as a | |\ \|/ \| * |/ | |/| | | PoBox 11215 a duck...she's made of wood" | |\ /|\ |\ * |\ | | | | Stanford CA 94309 "And therefore?" "A WITCH!" _|_|___|___|____|_\|___|__|__|_jkl@csli.stanford.edu___________________________