Re: [PATCH] IA64: cast has a higher precedence than '?'

From: Ingo Molnar
Date: Fri Feb 20 2009 - 07:37:38 EST



* Roel Kluin <roel.kluin@xxxxxxxxx> wrote:

> because of the ?: this is not strictly necessary, but I think the added
> parentheses are nice here.
>
> --------------------------->8-------------8<------------------------------
> A cast has a higher precedence than '?'

> @@ -61,7 +61,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
> struct pt_regs *regs,
> int error, long val)
> {
> - regs->ax = (long) error ?: val;
> + regs->ax = (long) (error ?: val);

it doesnt matter, does it? the 32-bit entity here is 'error', so
casting it to 64-bit long is just as fine as casting the end
result to long. In fact this should be the best:

regs->ax = error ?: val;

as the 32-bit 'error' will be extended to 64 bits anyway.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/