On Tue, Apr 28, 2009 at 9:18 AM, Zach Welch <[email protected]> wrote:
> On Tue, 2009-04-28 at 09:03 +0200, Michael Bruck wrote:
>> On Tue, Apr 28, 2009 at 8:23 AM, Øyvind Harboe <[email protected]>
>> wrote:
>> > Do we really want to go down the path of macros?
>>
>> Yes. The ifs obscure the actual algorithm by turning a short one-line
>> function call into five lines of (dense) operator soup with the actual
>> action lost somewhere in between.
>>
>>
>> > There are two audiences for this code:
>> >
>> > - those that work on the code all the time
>> > - the casual reader/debugger
>> >
>> > For the second group, the code is not less readable.
>>
>> I disagree. Unless what you are trying to read is the syntactic sugar
>> rather than the actual algorithm.
>
> I think I agree with Michael; I was thinking about a similar construct
> recently. I would up the ante with a variant that takes an error string
> that would printed on failure (CHECK_RETVAL_MSG?), as that is another
> common pattern where a macro would make sections of code easier to read.
>
> I also suggest putting these in more generic header than arm11.h.
Ok, but make the _MSG optional, not every intermediate function has
meaningful commentary to add.
A generic message addition to the CHECK_RETVAL could look something like this:
LOG_ERROR("error while calling \"" # action "\"");
Michael
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development