[sr-dev] git:andrei/rve_f_params: NEWS: notes about expressions in function parameters

Klaus Darilion klaus.mailinglists at pernau.at
Fri Aug 13 13:14:09 CEST 2010



Am 13.08.2010 11:11, schrieb Andrei Pelinescu-Onciul:
> The '+' operator is special in the sense that it converts its right
> operand to the type of the left operand and the result also has the type
> of the left operand. The other operators force conversion
> and always have a fixed return type (e..g '*' converts both of its
> operands to int and always returns int).
>
> More examples:
>
> "1" + 2 = "12"
> 1 + "2"  =>  error
> "1" + "2" = "12"
>
> "1" * 2 =>  error
> 1 * "2" =>  error
> "1" * "2" =>  error

Why are these errors? You said "The other operators force conversion"

regards
klaus

> (int)"1" * 2 = 2



More information about the sr-dev mailing list