On Thu, Jun 16, 2011 at 8:02 PM, Tomek CEDRO <[email protected]> wrote:

> On Thu, Jun 16, 2011 at 5:50 PM, Øyvind Harboe <[email protected]>
> wrote:
> > I take it is just a bugfix?
>
> Yes - it changes:
>
> retval = allow_transports(CMD_CTX, jtag_interface->transports ? :
> jtag_only);
>
> into:
>
> retval = allow_transports(CMD_CTX, jtag_interface->transports ?
> jtag_interface->transports : jtag_only);
>
> Which was obvious mistake or cautious precaution :-) :-)


Not true!

Your patch doesn't fix a bug, because there is none.

a ? : b is equivalent to a ? a : b, unless evaluating a has side-effects or
if a is volatile, since it's only evaluated once in the former case and
twice in the latter.

I don't think jtag_interface->transports is neither volatile nor a macro
with side-effects. So, in the name of portability (?: is a GCC extension
[1]) and clarity, I'd say this patch is valid, but not for the reasons given
in the patch comment.

/Andreas

[1] http://gcc.gnu.org/onlinedocs/gcc/Conditionals.html
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to