better C/C++ flags checking and handling