[cfe-dev] 64 to 32 truncation warnings for ints and floats?

Sean McBride sean at rogue-research.com
Fri Nov 12 08:50:53 PST 2010


Hi all,

In C & C++, Apple's gcc 4.2 produces 2 warnings for this code with -
Wshorten-64-to-32:

int main(int,char**)
{
	double d = 1.0;
	float f = d; // warning: 64 to 32
	
	long s1 = 10;
	long s2 = 20;
	int diff = s2 - s1; // warning: 64 to 32
	
	return 0;
}

clang (trunk) only warns for the integer case.  Is there a way to get
warnings for the double->float conversion too?

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada






More information about the cfe-dev mailing list