[sane-devel] Proposed Upgrade (pu) branches on GitLab
Johannes Meixner
jsmeix at suse.de
Fri Sep 25 08:12:50 UTC 2015
Hello,
On Sep 24 22:22 Olaf Meeuwissen wrote (excerpt):
> One, in sanei_ir.c, deserves some attention as it produces potentially
> undefined behaviour. It's really the same issue as reported in 311857,
> which I recently reopened.
>
> ../../../sanei/sanei_ir.c:481:11: warning: multiple unsequenced modifications to 'outi' [-Wunsequenced]
> *outi++ = *outi++ >> is;
>
> The two increments may occur in any given order, IIUC[3].
>
> [3] http://c-faq.com/expr/seqpoints.html
In general I would even demand that nowadays such kind
of fancy coding stlye should no longer be done at all.
With nowadays compiler optimizations it does not matter
if one writes
y = x++ * 2;
or
y = x * 2;
x++;
The former is selfish and oversophisticated coding.
In this case it is a mix-up of two separated things.
The latter is altruistic and explicit coding that
makes it obvious for others what actually is meant.
If the two separated things are meant as one statement
one might (ab)use the "one statement per line" rule
y = x * 2; x++;
which is still much more obvious than "y = x++ * 2;".
Of course everybody understands what "y = x++ * 2;" means.
This is only used here as a simple example.
Kind Regards
Johannes Meixner
--
SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard,
Graham Norton - HRB 21284 (AG Nuernberg)
More information about the sane-devel
mailing list