mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-30 14:20:05 +01:00
Merge branch 'feature/log_priusize_macro' into 'master'
feat(log): Added PRIuSIZE printf formatter macro See merge request espressif/esp-idf!29725
This commit is contained in:
20
components/log/include/inttypes_ext.h
Normal file
20
components/log/include/inttypes_ext.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* This header provides PRIuSIZE, a printf formatter macro for size_t which is similar to the macros
|
||||
* PRIuX defined in inttypes.h. It is necessary because size_t has different width on different
|
||||
* platforms (e.g., Linux and ESP32). The alternative would be always casting parameters
|
||||
* to a certain type in printf and logging functions.
|
||||
*/
|
||||
|
||||
#if __SIZE_WIDTH__ == 64 // __SIZE_WIDTH__ is defined by both GCC and Clang
|
||||
#define PRIuSIZE "lu"
|
||||
#else
|
||||
#define PRIuSIZE "u"
|
||||
#endif
|
||||
Reference in New Issue
Block a user