I am using Code::Blocks for learning C++. Consider the following code:
C
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
const int i = 0;
int* j = (int*)&i;
}
The cast I have used in the above program has been deprecated in C++ (if I’m correct about this), but was followed in C. The Code::Blocks IDE doesn’t show me any warning for this code. I know that C++ supports the explicit casts such as const_cast, static_cast, etc.
My question is: Are there any free IDE available on the internet that show warning for such deprecated syntax?
You also can enable those warnings in Code::Blocks. You need to add the compiler flag -Wold-style-cast for that. This is how I did it in Code::Blocks:
Then you will get output like this with your code: