[clang-tools-extra] [clang-tidy] Add portability-avoid-platform-specific-fundamental-types (PR #146970)
JJ Marr via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 5 12:52:25 PDT 2025
================
@@ -0,0 +1,111 @@
+.. title:: clang-tidy - portability-avoid-platform-specific-fundamental-types
+
+portability-avoid-platform-specific-fundamental-types
+=====================================================
+
+Finds fundamental types and recommends using typedefs or fixed-width types instead.
+
+This check detects fundamental integer types (``int``, ``short``, ``long``, ``long long``, and their
+``unsigned`` variants) and warns against their use due to non-standard platform-dependent behavior.
+For example, ``long`` is 64 bits on Linux but 32 bits on Windows. There is no standard rationale or
+intent for the sizes of these types.
+
+Instead of fundamental types, use fixed-width types such as ``int32_t`` or implementation-defined
+types with standard semantics, e.g. ``int_fast32_t`` for the fastest integer type greater than or
----------------
jj-marr wrote:
Done locally.
https://github.com/llvm/llvm-project/pull/146970
More information about the cfe-commits
mailing list