/[Apache-SVN]
ViewVC logotype

Revision 1005170


Jump to revision: Previous Next
Author: dreiss
Date: Wed Oct 6 17:10:53 2010 UTC (14 years, 1 month ago)
Changed paths: 1
Log Message:
THRIFT-926. cpp: remove auto-stringification in TLogging.h

The T_DEBUG* and T_ERROR* macros used preprocessor stringification to
stringify the format string argument.  This was weird and unintuitive.

With the old behavior:

- Quotes surrounding the format string were included in the message:
  T_DEBUG("this is a test") --> expanded to  "\"this is a test\""

- Backslashes in the string are escaped so they print literally:
  T_DEBUG("foo\nbar")       --> expanded to  "\"foo\\nbar\""

- Standard fixed-width integer format macros don't work:
  T_DEBUG("x: %" PRIi64, x) --> expanded to  "\"x: %\" PRIi64"

The last item is particularly problematic, since it prevents 64-bit
values from being logged portably.

With the new code, the following will no longer compile:

  T_DEBUG(this is my log message: %d, 5)

I don't think that is a bad thing, though.

Changed paths

Path Details
Directoryincubator/thrift/trunk/lib/cpp/src/TLogging.h modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26