X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_13%2Fexo1%2Flib%2Fmacros.h;h=f485a9afabfb96f282b9cccd17ffe55ed49af65a;hb=811d4abe716c4d14629cee5beda1e1f3cff979bc;hp=ab500dfb25d34e25e6e17272e317505f0a887886;hpb=fac749d5f8fab2991c3b149b82f168cec194362b;p=TD_C.git diff --git a/TP_13/exo1/lib/macros.h b/TP_13/exo1/lib/macros.h index ab500df..f485a9a 100644 --- a/TP_13/exo1/lib/macros.h +++ b/TP_13/exo1/lib/macros.h @@ -3,7 +3,7 @@ * * Filename: macros.h * - * Description: + * Description: Some useful macros * * Version: 1.0 * Created: 09/03/2017 15:28:46 @@ -19,12 +19,14 @@ #ifndef MACROS_H #define MACROS_H +#include + /* definition to expand macro then apply to pragma message */ #define VALUE_TO_STRING(x) #x #define VALUE(x) VALUE_TO_STRING(x) #define VAR_NAME_VALUE(var) #var "=" VALUE(var) -#define ARRAY_SIZE(arr) ({typeof (arr) arr ## _is_a_pointer __attribute__((unused)) = {}; \ - sizeof(arr) / sizeof(arr[0]);}) +/* FIXME: ensure we manipulate real array */ +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) -#endif /* MACROS_H */ +#endif /* MACROS_H */