================
@@ -0,0 +1,11 @@
+.. title:: clang-tidy - bugprone-casting-through-void
+
+bugprone-casting-through-void
+=============================
+
+A check detects usage of ``static_cast`` pointer to the other pointer throght
+``static_cast`` to ``void *`` in C++ code.
+
+Use of these casts can violate type safety and cause the program to access a
----------------
PiotrZSL wrote:

Maybe something like this:

Two-step type conversions via void* are discouraged for several reasons. 
Firstly, they obscure code and impede its understandability, complicating 
maintenance. Additionally, these conversions bypass valuable compiler support, 
erasing warnings related to pointer alignment and potentially leading to 
undefined behavior. In scenarios involving multiple inheritance, ambiguity and 
unexpected outcomes can arise due to the loss of type information, posing 
runtime issues. In summary, avoiding two-step type conversions through void* 
ensures clearer code, maintains essential compiler warnings, and prevents 
ambiguity and potential runtime errors, particularly in complex inheritance 
scenarios.


https://github.com/llvm/llvm-project/pull/69465
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to