Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1610990
| From | Jan Engelhardt <jengelh@inai.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] netfilter: ipset: Use max macro instead of ternary operator |
| Date | 2017-03-28 16:10 +0200 |
| Message-ID | <tpZYR-lk-9@gated-at.bofh.it> (permalink) |
| References | <tpZvQ-8gn-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tuesday 2017-03-28 15:32, simran singhal wrote: >This patch replaces ternary operator with macro max as it shorter and >thus increases code readability. > >- return (ret < 0 ? 0 : ret); >+ return max(0, ret); While the two are functionally equivalent, "max" conveys a meaning of "upper bound" (think ceil(3)), i.e. a _count of something_, but the function still returns a logical "error or bool". Such a change may be usable in an IOCCC or a codegolf contest, but it destroys rather than improves readability IMHO.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] netfilter: ipset: Use max macro instead of ternary operator simran singhal <singhalsimran0@gmail.com> - 2017-03-28 15:40 +0200 Re: [PATCH] netfilter: ipset: Use max macro instead of ternary operator Jan Engelhardt <jengelh@inai.de> - 2017-03-28 16:10 +0200 RE: [PATCH] netfilter: ipset: Use max macro instead of ternary operator David Laight <David.Laight@ACULAB.COM> - 2017-03-28 16:20 +0200
csiph-web