Re: Fwd: [glennrp/libpng] Apple clang 8.1.0 warnings (#156)
John Bowler <[email protected]>
| Newsgroups | gmane.comp.graphics.png.devel |
|---|---|
| Message-ID | <CAP7U3982u1DBqDoGHyuKT7soYp-Fb=khG9rZtOPpJtdM9BxoeA@mail.gmail.com> |
Ok, perhaps I should be more clear; function-like macros with side effects
are an essential part of the language. The original UNIX 'putc'
implementation is a classic example. Attempting to outlaw the underlying
construct, in other words attempting to outlaw the comma operator, seems
like compiler over-reach.
I have a particular interest in this because I never use {} for a simple
conditional in libpng simply because the formatting rules make the
resultant code almost impossible for me to debug; a four line if/else
blossoms into and 8 line mess.
If you really seriously want to ban "," then let's get some reasonable
formatting rules for if {} else {}, do {} while () and so on.
Incidentally the Norcroft compiler warning was the correct one; it warns if
there is a voided expression with no side effect (or function call), so a
correct comma operation doesn't warn. clang could do this too, rather than
suggesting meaningless syntactic garbage, the fact that it doesn't shows
that the writers are reinventing the wheel, with added corners. Surely any
C programmer knows that the lhs of "," is voided?
John Bowler
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement