Thread (40 messages) 40 messages, 7 authors, 2017-05-02

Re: [PATCH 4/5] diff: use SWAP macro

From: Johannes Schindelin <hidden>
Date: 2017-01-30 16:12:30

Hi René,

On Sat, 28 Jan 2017, René Scharfe wrote:
Use the macro SWAP to exchange the value of pairs of variables instead
of swapping them manually with the help of a temporary variable.  The
resulting code is shorter and easier to read.

The two cases were not transformed by the semantic patch swap.cocci
because it's extra careful and handles only cases where the types of all
variables are the same -- and here we swap two ints and use an unsigned
temporary variable for that.  Nevertheless the conversion is safe, as
the value range is preserved with and without the patch.
One way to make this more obvious would be to change the type to signed
first, and then transform (which then would catch these cases too,
right?).

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help