On Wed, Nov 23, 2011 at 12:59:00PM +0000, Michael Meeks wrote: > The attached test contrasts:
> fprintf (stderr, "P is %s and b is %d\n", p, b); > vs. > std::cout << "P is " << p << " and b is " << b << "\n"; > Given that the real per-site difference is larger. Add to this > the issue that there are real translation problems with the 2nd > approach (that it cannot be appropriately re-ordered), and IMHO the > argument here is overwhelmingly against 'cute' operator-overloading > approaches Translation? Isn't that for debug logging? Do we translate the strings in OSL_TRACE et al? That seems like wasted time... Anyway, for a developer not already well acquainted with the code, the C++ streams approach has the *huge* advantage that (s)he can add debugging printfs without finding out how to transform *this* object into a zero-terminated array of characters. If it makes sense to do it, just use "<<" and it will do the right thing. *Much* easier. Also, more generally, in the face of platform-dependent typedefs of integer types, *I*, for one, never really know which length modifier to use in the format string :-( %d? %ld? Look at how glibc had to solve this issue with an extension length modifier 'z' just so that people can print the size of something! If I were dictator, the "printf-like format string" approach would be proscribed. I'm not dictator ;-) -- Lionel _______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
