I'm quite surprised when I compile the following code without any warning using g++ 4.1.2 with -Wall -Wextra -Wconversion enabled.
I want g++ to show me every warning to avoid potential harm. I have to stick to g++ 4.1.2.
#include <stdint.h>
#include <string>
using namespace std;
int main()
{
uint8_t u1=1;
uint64_t u64=1000;
string s1="";
u1=u64; // want warning here
s1=u64; // want warning here
s1=u1;
}
I'm afraid GCC before 4.3 doesn't seem to support this. The description of -Wconversion
changed between 4.2 and 4.3 to reflect the new warning behavior, and there is no indication that pre-4.3 GCC would check for this.
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