Avoid C-style casts for pointers in docs (#2487)
Why only for pointers? Because C casts are hard to grep for.
diff --git a/docs/advanced/misc.rst b/docs/advanced/misc.rst
index 0a73dae..8342210 100644
--- a/docs/advanced/misc.rst
+++ b/docs/advanced/misc.rst
@@ -176,9 +176,9 @@
.. code-block:: cpp
- auto data = (MyData *) py::get_shared_data("mydata");
+ auto data = reinterpret_cast<MyData *>(py::get_shared_data("mydata"));
if (!data)
- data = (MyData *) py::set_shared_data("mydata", new MyData(42));
+ data = static_cast<MyData *>(py::set_shared_data("mydata", new MyData(42)));
If the above snippet was used in several separately compiled extension modules,
the first one to be imported would create a ``MyData`` instance and associate