Liste des Groupes | Revenir à cl c |
On Wed, 23 Apr 2025 11:15:01 +0100That does not need expandable macros.
bart <bc@freeuk.com> wibbled:IMV, macros generally are a bad idea. They are especially bad with howC macros do essentially 4 different things:
they are implemented in C:
1) Provide a way to pass compilation data directly into the code via compiler
switches and #ifdef
2) Allow conditional compilation for different OS's
3) Allow repeating blocks of code to be compacted into a single macro whenHave you ever implemented a C preprocessor?
having a function instead would be more complicated and/or inefficient.
4) An alternative to inline functions. Probably the least useful.
* Their implementation is complex and poorly defined.Maybe to you.
So, is that good or bad? (Let me guess: it's good that it works like that!)* Macros don't obey normal scope rules.They're not supposed to.
So what? You'd get a compilation error.If you're lucky. Or you get a silent, undetectable bug, since any alphanumeric token: identifier, type, or reserved word, gets expanded, no matter what the context.
Les messages affichés proviennent d'usenet.