I like/hate linters so I figured I'd try clang-tidy
with all the checks turned on and see how I'm doing and how I can improve. Aside from stylistic or non-applicable rules, I hit this call:
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void *)0);
which triggers C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting]
so I fixed it with a static_cast<void *>(nullptr)
with the nullptr
for good measure. Then I naively "fixed" the next one:
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), static_cast<void *>(3 * sizeof(float)));
which is an actual error because you can't cast an unsigned long
to void *
. Fair enough, my bad. I figured an unsigned long
was a good candidate for a reinterpret_cast
, and so I did, and it compiled fine and ran fine, except that C++ Core Guidelines say do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]
.
Short of dynamic_cast
, which is a bit silly here, what are my options here?