Sujet : Re: Loops (was Re: do { quit; } else { })
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 23. Apr 2025, 19:43:33
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250423113224.711@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-04-23, bart <
bc@freeuk.com> wrote:
On 23/04/2025 16:31, David Brown wrote:
On 22/04/2025 22:03, bart wrote:
>
Too few levels of functions and/or macros (there is no semantic
difference between macros and functions in this matter)
>
There is a great deal of difference. Functions tend to be well-formed in
their inputs and outputs.
>
Macros take some abitrary blocks of syntax and return another arbitrary
block of syntax:
>
#define INDEX(a, b, y) a y b
INDEX(a, i, [) ];
While that's terrible, I've never seen anything like it in the wild.
Macros which open a brace, relying on the invocation of a paired
macro to close it, are reasonably common.
The macro we had been discussing whereby the for (..) part of
a loop is also an example of something which generates a syntactic
fragment, which must be completed by something which follows
the macro, namely a statement.
Speaking purely in terms of formal syntqx, this is exactly what is going
on in your example with the completing closing bracket. In that
situation, it gives us a useful technique whose use is clear.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca