Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: printk-formats: add ptrdiff_t type to printk-formats

When print the difference between two pointers, we should use
the ptrdiff_t modifier %t.

Signed-off-by: Miles Chen <miles.chen@mediatek.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Miles Chen and committed by
Jonathan Corbet
88288ed0 f0ae2cfa

+14
+14
Documentation/core-api/printk-formats.rst
··· 135 135 grep'able. If in the future we need to modify the way the kernel handles 136 136 printing pointers we will be better equipped to find the call sites. 137 137 138 + Pointer Differences 139 + ------------------- 140 + 141 + :: 142 + 143 + %td 2560 144 + %tx a00 145 + 146 + For printing the pointer differences, use the %t modifier for ptrdiff_t. 147 + 148 + Example:: 149 + 150 + printk("test: difference between pointers: %td\n", ptr2 - ptr1); 151 + 138 152 Struct Resources 139 153 ---------------- 140 154