--- In [email protected], Thomas Hruska <[EMAIL PROTECTED]> wrote: > > John Matthews wrote: > > --- In [email protected], ed <ed@> wrote: > >> On Sat, 19 Jul 2008 12:32:23 -0000 > >> "John Matthews" <jm5678@> wrote: > >> > >>> --- In [email protected], Thomas Hruska <thruska@> wrote: > >>>> kathir resh wrote: > >>>>> since printf is function it returns the no of characters > >>>>> printed...how to view the no of charaters it returns..... > >>>> printf("%d\n", printf("Hi!\n")); > >>> Slight variation: > >>> > >>> printf("%d\n", printf("no of characters = ")); > >>> > >> How do you know when flush is called? It could be after the nested > >> function, although it should happen after writing \n, it's possible for > >> it to happen before the outer printf I believe. > > > > Sorry Ed- not sure I understand. Does it matter when the flush > > happens, as long as the characters go into the output stream in the > > expected order ie. inner before outer? And isn't that guaranteed by > > the inner printf having to be evaluated before the outer executes? > > > > To be honest I wasn't sure myself whether this 'nesting' of printfs is > > ok, but if Thomas thinks it is, that's good enough for me :-) > > > > John > > I never really said that it is okay. I don't generally nest function > calls (line length and the number of parenthesis starts getting kind of > hairy). But, in this case, I assumed it was for some sort of debugging > purpose. In which case, it probably is fine.
It was the specifics of printf I was worried about rather than nesting in general. I know the inner printf is guaranteed to be evaluated before the outer printf, but is that enough to guarantee that the 2 printf arguments don't somehow get mixed up in the output stream?
