News for hackers. Stuff that matters.
Re:C – Preliminary C2x Charter by colanderman on Thursday March 17, 2016 @12:27PM (#11305414)
If you're using GNU C:

    #define AUTO(var, def) __typeof__(def) var = (def)

    AUTO(x, 3);
Re:C – Preliminary C2x Charter by comex on Thursday March 17, 2016 @08:25PM (#11308861)
Or, 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.