diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2010-10-05 14:28:50 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-10-09 08:16:45 +0000 |
commit | 9a85d3944715c709d740edb987b84bd657b9d7ef (patch) | |
tree | 16ae216eeb23b6294efc2a36268d37c2cf8286fa /docs/tracing.txt | |
parent | 3e18c6bf7740e4a75503b803ec7d5dc29a531e4f (diff) |
trace: Use portable format strings
It is not portable to use "%ld" for int64_t because int64_t may have
type long on 64-bit platforms and long long on 32-bit platforms. Use
the standard library PRId64 macros to keep format strings portable.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'docs/tracing.txt')
-rw-r--r-- | docs/tracing.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/tracing.txt b/docs/tracing.txt index ae01ff1378..5504850857 100644 --- a/docs/tracing.txt +++ b/docs/tracing.txt @@ -72,6 +72,10 @@ Trace events should use types as follows: * For everything else, use primitive scalar types (char, int, long) with the appropriate signedness. +Format strings should reflect the types defined in the trace event. Take +special care to use PRId64 and PRIu64 for int64_t and uint64_t types, +respectively. This ensures portability between 32- and 64-bit platforms. + === Hints for adding new trace events === 1. Trace state changes in the code. Interesting points in the code usually |