Liste des Groupes | Revenir à cl c |
On 2025-04-23, bart <bc@freeuk.com> wrote:So you /have/ seen things like that. There are entire libraries built solely with the C processor, some even implement languages; they will use every trick they can.On 23/04/2025 16:31, David Brown wrote:While that's terrible, I've never seen anything like it in the wild.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, [) ];
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 ofSuch libraries as I mentioned for embedded languages or syntax wrapping are clever, but usually impractical, unwieldy and inefficient.
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.
Les messages affichés proviennent d'usenet.