Comment

Comment by Spiritus

What's the deal with the `while ... while(0)` and `do ... while(0)` macros? Is it some scoping trick?

    #define TKVDB_EXEC(FUNC)           \
    do {                               \
        TKVDB_RES r = FUNC;            \
        if (r != TKVDB_OK) {           \
            return r;                  \
        }                              \
    } while (0)

    #define TKVDB_SKIP_RNODES(NODE)    \
    while (NODE->c.replaced_by) {      \
        NODE = NODE->c.replaced_by;    \
    } while (0)
parent Spiritus 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton