Sujet : Re: Loops (was Re: do { quit; } else { })
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 22. Apr 2025, 21:03:21
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vu8sm8$18fhc$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
User-Agent : Mozilla Thunderbird
On 22/04/2025 20:26, Kaz Kylheku wrote:
On 2025-04-22, bart <bc@freeuk.com> wrote:
Or would you automatically say it was reasonable no matter how many
levels there were, just to disagee with me and to side with a fellow C
programmer?
You're trying to say that C is a bad language because you can have
7 or more layers of macro expansion, but you're not considering how
bizarre and crippling restriction it would be to put a cap on it.
Here, I'm trying to determine if this is the poster's honest, objective opinion, or whether they'd always going to be defend such code no matter what.
14 levels of macros? No problem; I'm sure there was a good reason!
I did ask at one point whether anybody could link to some truly terrible C code; nobody has so far.
I just want to find out the threshold at which some will actually agree that macros have been abused or their use is over the top and unjustified.
There doesn't seem to be any limit - or not any that they want to admit to me.
> but you're not considering how
> bizarre and crippling restriction it would be to put a cap on it.
There WILL be a cap. Some deep nesting might be justified in special cases, for example some recursive macro that builds a string a character at a time.
But this was not such a case; it was simply decided to make it work using macros instead of functions.
As for being crippling: I've written all sorts of language apps, including interpreters like this, without ever using more than one level, and for several decades, zero levels.
A language like C provides all these odd-ball features, people are going to use them.