3 ms·
If you're using GNU C: #define AUTO(var, def) __typeof__(def) var = (def) AUTO(x, 3);
by colanderman 11y ago
If you're using GNU C:
#define AUTO(var, def) __typeof__(def) var = (def)
AUTO(x, 3);
- comex 11y agoOr, as of GCC 4.9 and Clang 3.8, just use __auto_type. It avoids duplicating the source expression, which duplicates compiler errors if the expression is erroneous and can actually repeat side effects in the rare cases involving variable-length arrays.