Follow-up Comment #1, bug #41689 (project avr-libc):

_Static_assert may be ugly, but it's what ISO C mandates:

http://en.cppreference.com/w/c/language/_Static_assert

static_assert is syntactic sugar imported by <assert.h>.

With gcc, here is a bit of confusion on which is defined when. gcc 4.6
supports _Static_assert, but assert.h has static_assert only when std==c11. In
gcc 4.7, static_assert is defined by assert.h even if std!==c11 (apparently).

I use the following chunk of code to get as much as is available:

#if (__STDC_VERSION__ >= 201112L)
#include <assert.h>
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define static_assert(condition, message) _Static_assert(condition, message)
#else
#define static_assert(condition, message)
#endif

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41689>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to