Re: [dev] [st] [PATCH 4/3] tresize: remove unnecessary if

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Mon, 13 Apr 2015 10:26:08 +0200

> The assembly is rather irrelevant in this case. Let's write the code
> the way it is most understandable and clear.

Yeah, I totally agree with you here.

> I'd remove the if, memmove is equivalent to a non-op when the offset
> is 0.

But the problem now is to decide what is more understable. I prefer
an explicit if, because it alerts to the programmer about this case, but
the no-if version is shorter and without indentation, that usually
means that it is more understable.

The fact you can pass a size=0 to memcpy and memmove is one
of the most stupid things you can find in the C standard, because
it is illogical and remove a lot of optimizations in some processors,
so I don't know if honour this rule is something we should do.

Regards,
Received on Mon Apr 13 2015 - 10:26:08 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 13 2015 - 10:36:07 CEST