This is exactly the thing we could change by giving the compiler hints.
> --- no.c ---
> main(void)
> {
> int i, j;
>
> scanf("%d %d\n", &i, &j);
>
> if (!i)
> exit();
> i++;
> if (!j)
> _exit();
> j++;
> }
> --- end ---
This is quite readable.
> --- yes.c ---
> main(void)
> {
> int i, j;
>
> scanf("%d %d\n", &i, &j);
>
> if (!i)
> goto out;
> i++;
> if (!j)
> goto out1;
> j++;
> out:
> exit();
> out1:
> _exit();
> }
> --- end ---
what I would like is something like
--- yestoo.c ---
int main(void)
{
int i,j;
scanf("%d %d\n", &i, &j);
__builtin_hint(i != 0);
if (!i)
exit();
i++;
__builtin_hint(j != 0);
if (!j)
_exit()
j++;
}
----
> --- yes.dump ---
The assembly output should be quite the same for yes.c and my version ...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/