Re:I_suck_and_my_tests_are_order_dependent
by munch117 on Friday February 17, 2023 @03:26AM
(#34832238)
Not so much, you could phase out C-style casts over time. C++ compilers could grow options to warn about C-style casts (if they haven't already), shops could outlaw them in coding style guides, and slowly it would go away.
What does kinda defeat the point is that C++ adds a new form of cast that is even less conspicuous than a C-style cast:
typedef int* int_p;
int f(char* p)
{
int* ip = int_p(p); // basically a reinterpret_cast
return *ip;
}
int main(int argc, char** argv)
{
return f(argv[0]);
}
What does kinda defeat the point is that C++ adds a new form of cast that is even less conspicuous than a C-style cast:
gcc -Wall compiles this with no warnings.