Re: stupid desktop question
On Thu, Dec 16, 2004 at 04:51:10PM +1100, Ian Wienand wrote:
> - int x = workareas [i];
> - int y = workareas [i + 1];
> - int width = workareas [i + 2];
> - int height = workareas [i + 3];
> + int x = (int) workareas [i];
> + int y = (int) workareas [i + 1];
> + int width = (int) workareas [i + 2];
> + int height = (int) workareas [i + 3];
How does this bit make any difference? C99 6.5.4:
Preceding an expression by a parenthesized type name converts the
value of the expression to the named type. This construction is called
a cast. A cast that specifies no conversion has no effect on the
type or value of an expression.
and 6.5.16.1:
In simple assignment (=), the value of the right operand is converted
to the type of the assignment expression and replaces the value stored
in the object designated by the left operand.
--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
Reply to: