OT Ceckarsky kviz II

Lukáš Grepl L.Grepl@sh.cvut.cz
Čtvrtek Březen 5 18:38:28 CET 2009


> If an int can represent all values of the original type, the value is
> converted to an int;
> otherwise, it is converted to an unsigned int. These are called the integer
> promotions.48) All other types are unchanged by the integer promotions.

Tohle to má určité vtipné důsledky. Zrovna před pár dny jsem se s tím 
pěkně vypekl a to jsem si (naivka) myslel, že už mi integral promotion 
nedělá problémy.

Takže když už jsme u těch kvízů, jakých hodnot může nabývat c?

	int a = -50;
	unsigned int b = 50;

	int c = a * b / 10;

Lukáš Grepl

P.S. Integral promotion: It doesn't have to be logical. It's the law.



Další informace o konferenci Hw-list