Re: [Openocd-development] [PATCH 02/20] add COMMAND_HANDLER and COMMAND_HELPER macros

2009-11-11 Thread Zach Welch
On Wed, 2009-11-11 at 12:04 -0700, David Brownell wrote: > > +#define CALL_COMMAND_HANDLER(name, extra...) \ > > + name(cmd_ctx, cmd, args, argc, ##extra) > > That one I don't like. It relies on lexical capture > for most parameters, and doesn't even use "name". name is right up there

Re: [Openocd-development] [PATCH 02/20] add COMMAND_HANDLER and COMMAND_HELPER macros

2009-11-11 Thread David Brownell
> +#define CALL_COMMAND_HANDLER(name, extra...) \ > + name(cmd_ctx, cmd, args, argc, ##extra) That one I don't like. It relies on lexical capture for most parameters, and doesn't even use "name". Lexical capture is one of the classic Things To Avoid for C macros ... a Dirty Trick, wh

[Openocd-development] [PATCH 02/20] add COMMAND_HANDLER and COMMAND_HELPER macros

2009-11-11 Thread Zachary T Welch
The COMMAND_HANDLER and COMMAND_HELPER macros allow commands to be defined in a manner that decouples them from the exact order and type of their parameters. Once converted, incremental changes to the command handler type can be addressed in incremental patches that do not need to touch the entire