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?
I'm assuming CodeBlocks is compiling using gcc. You can enable a warning by adding the compiler flag -Wold-style-cast
. You might have to poke around in CodeBlocks to figure out where to put that flag. You can also enable a bunch more warnings with -Wall
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With