Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Sort of trivial code challenge - may be interesting to you anyway Date: Wed, 11 Mar 2026 14:40:13 -0700 Organization: A noiseless patient Spider Lines: 56 Message-ID: <86eclq82pu.fsf@linuxsc.com> References: <10n80sc$3soe4$1@dont-email.me> <86v7feei2e.fsf@linuxsc.com> <10o53k6$1i0ef$2@dont-email.me> <86ms0peby6.fsf@linuxsc.com> <10ockdh$3qpk6$1@dont-email.me> <10ocrjn$3qpk6$2@dont-email.me> <10od64s$3qpk6$4@dont-email.me> <86ikb9bmtw.fsf@linuxsc.com> <10oem5t$n5hk$1@dont-email.me> <86o6kz9zng.fsf@linuxsc.com> <10oi72k$1rss6$1@dont-email.me> <10oid0u$1u9aa$2@dont-email.me> <10ok1sl$2e7mc$1@dont-email.me> <10ok405$2f6sn$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Wed, 11 Mar 2026 21:40:30 +0000 (UTC) Injection-Info: dont-email.me; posting-host="5f44bcdbc02769ce6998caa4a4cb2206"; logging-data="1553024"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/U3h2/++U38o5i9JgRrZSqHhgOsgTsUwA=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:P4DfkTaxQ+K9/M00w3s/UKjkHCo= sha1:c+92u5659pcIXh8/vvNylYqz9bU= Xref: csiph.com comp.lang.c:396915 scott@slp53.sl.home (Scott Lurndal) writes: > Bart writes: > >> On 08/03/2026 14:42, DFS wrote: >> >>> On 3/7/2026 6:40 PM, Janis Papanagnou wrote: >>> >>>> On 07.03.26 22:58, DFS wrote: >>>> >>>>> On 3/7/2026 3:02 PM, Tim Rentsch wrote: >>>>> >>>>>> [...] >>>>> >>>>> What do you think would be the reaction in a corporate programming >>>>> dept to this unique kind of code? >>>> >>>> From my experiences in a couple such departments of professional >>>> software development... >>>> >>>> The "uniqueness" would not be a problem. It would have failed to >>>> many requirements that maintainable code was expected to have. >>> >>> I figured as much. >>> >>> >>> Nested ternaries like this: >>> >>> c = square ? a1 : !hwc ? h*w : a3 > h*w ? h*w : a3; >>> >>> are harder to decipher at first glance than 3 or 4 levels of indented >>> if-then-elses. >> >> TR doesn't like parentheses around ?: terms; everyone is expected to >> know their precedence. > > Most coding standards, IIRC, specify that explicit groupings > should be used, so any future code reader would know what > the programmer intended. Some miscellaneous thoughts on programming style: Most "coding standards" are style guidelines, not coding standards. Aesthetic debates are never just about aesthetics. Large-scale structure is more important than small-scale details. "Readable" means different things to different people. Most of the comments about readability are like what the Supreme Court said about pornography: they can't define it, but they know it when they see it. Remember the advice of Dijkstra: don't make the mistake of thinking something is convenient just because it is conventional.