Comment

Comment by PeCaN

I didn't realize statement expressions were a GCC extension.

How do you do the safe min/max in MSVC? e.g.

    #define min(a,b) ({ \
      __typeof__(a) _a = (a); \
      __typeof__(b) _b = (b); \
      _a > _b ? _b : _a; \
    })
works well in GCC/Clang. MSVC has decltype(a) _a instead of__typeof__, but I didn't know it doesn't have blocks-as-expressions.
parent PeCaN 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton