Liste des Groupes | Revenir à l c |
David Brown <david.brown@hesbynett.no> writes:That is also an issue in the world of small-systems embedded programming.On 29/05/2025 14:49, Andrey Tarasevich wrote:And sometimes, excessive use of the comma operator causesOn Wed 5/7/2025 12:37 AM, David Brown wrote:>>>>
That would get an immediate downcheck during review for exactly
that reason.
Of course. In fact, if someone presented such code for review (and
assuming I noticed the commas!) I'd have to consider whether it was
done maliciously, intentionally deceptively, due to incompetence, or
smart- arse coding. In all my C coding experience, I can't recall
ever coming across a single situation when I thought the use of the
comma operator was appropriate in the kind of code I work with.
Wow! That's catastrophically bad.
>
As it has been stated many times before, both C and C++ are programming
languages that embrace both statement-level and expression-level
programming. Expression-level programming (e.g. where `?:` is used for
branching and `,` for sequencing) is a very valuable and massively
important programming paradigm in these languages. The fact that
elaborate expression-level programming is not in nay way abandoned or
shunned today is pretty obvious in C++, since C++ took major steps
lately to develop its expression-level capabilities. But it has always
been and will always remain important in C as well.
No, expression-level programming has always been and will likely always
remain a very minor part of C programming. Yes, some people make use of
the comma operator. Some people do so extensively - and they are often,
but not necessarily, considered "smart-arse" programmers rather than
"smart" programmers. If the comma operator were removed from the C
language, I guess some 95% of programmers would barely notice - at
worst, they would have to add an extra line inside an occasional "for"
loop. (The tertiary operator is used much more.)
compiler failures.
cfront generated the comma operator extensively, and expression treesOf course people are experienced in different things - "programming", even when limited to a single language, is a broad field.
would grow to very large sizes. There was a bug in PCC (for the
88100) where it would run out of temporary registers while generating
code for some cfront generated comma expressions (which were -far- from
human readable). I had to fix the temporary register allocation
code in PCC to spill registers when the sethi-ullman number for an
expression exceeded the number of registers.
That was circa 1990, and I've generally not found any arguments
favoring their general use persuasive in the years since, including
Andrey's and Kaz's responses recently posted here.
The simple fact that experienced programmers that read this usenet
newsgroup missed the comma operators in the original example speaks
volumes.
Les messages affichés proviennent d'usenet.