Simplifying casting in my C/C++ qsort char** comparator function
How about this? 

int comparator(const void* a, const void* b)
{
#ifdef __cplusplus
    auto a_recast = static_cast&lt;const char* const *&gt;(a);
    auto b_recast = static_cast&lt;const char* const *&gt;(b);
    return std::strcmp(*a_recast, *b_recast);
#else
    return strcmp(*(const char* const *) a, *(const char* const *) b);
#endif
}


To elaborate, the reason that you had to go through the convoluted series of dangerous casts is that you actually were stripping constness. 
const void* means a promise not to change whatever the void turns out to be. That is, the thing pointed at by the rightmost star is const. const char ** on the other hand means a promise not to change the individual characters, but doesn't guarantee that you won't change the direct pointers to those characters. However, it's the pointers to those characters that are pointed at by the rightmost star. Intuitively perhaps, think of char * as being in a unit by itself a c_string, and your a and b are arrays of constant c_strings. 

The reason that clang warns about c style casts is precisely that they let you apply such a crazy list of operations and changing constnesses without necessarily realizing what is happening. 

As an aside, as far as the compiler is concerned, it is actually only necessary to enforce constness on the pointer. That is, you could also compile with static_cast&lt;char * const *&gt;. I put the additional const in because when your conceptual c_string is constant, you conceptually don't want to be changing any of the characters. (And you probably want the compiler to alert you if anything tries to do that.)