[clang] [clang-tools-extra] [clang-tidy] Add portability-avoid-platform-specific-fundamental-types (PR #146970)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 19 13:47:16 PDT 2025


================
@@ -0,0 +1,241 @@
+.. title:: clang-tidy - portability-avoid-platform-specific-fundamental-types
+
+portability-avoid-platform-specific-fundamental-types
+=====================================================
+
+Detects fundamental types (``int``, ``short``, ``long``, ``long long``, ``char``
+, ``float``, etc) and warns against their use due to platform-dependent 
+behavior.
+
+This check detects fundamental types (``int``, ``short``, ``long``, ``float``,
+``char`` and their ``unsigned`` or ``signed`` 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.
----------------
vbvictor wrote:

Remove duplication

https://github.com/llvm/llvm-project/pull/146970


More information about the cfe-commits mailing list