Request for testing on fold-const.c patch
Phil Edwards
phil@codesourcery.com
Tue Jul 27 08:47:00 GMT 2004
On Mon, Jul 26, 2004 at 06:26:48PM -0400, Richard Kenner wrote:
> Seriously, though, I consider this sort of thing far cleaner than the
> alternative approach where you break it up into separate return statements by
> inverting the conditions. In this case, that would be:
>
> if (!operand_equal_p (TREE_OPERAND (arg0, 0),
> TREE_OPERAND (arg1, 0), flags))
> return 0;
>
> if (!operand_equal_p (TREE_OPERAND (arg0, 1),
> TREE_OPERAND (arg1, 1), flags))
> return 0;
>
>
> if ((!TREE_OPERAND (arg0, 2) || !TREE_OPERAND (arg1, 2))
> ? TREE_OPERAND (arg0, 2) != TREE_OPERAND (arg1, 2)
> : operand_equal_p (TREE_OPERAND (arg0, 2),
> TREE_OPERAND (arg1, 2), flags))
> return 0;
>
> return ((!TREE_OPERAND (arg0, 3) || !TREE_OPERAND (arg1, 3))
> ? TREE_OPERAND (arg0, 3) == TREE_OPERAND (arg1, 3)
> : operand_equal_p (TREE_OPERAND (arg0, 3),
> TREE_OPERAND (arg1, 3), flags));
>
> I find the former *much* cleared because it puts everything related together
> in one place while the latter distributes it over many lines.
The latter is far, far easier to step through in gdb.
--
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
- Brian W. Kernighan, in a plea for clear, straightforward code
More information about the Gcc-patches
mailing list