1

I came across the following macro:

#define ITERATE_MACRO(type, entries, size, n)               \
({                                                          \
     unsigned int __i, __n;                                 \
     int __ret = 0;                                         \
     type *__entry;                                         \
     for (__i = 0, __n = 0; __i < (size);                   \
         __i += __entry->next_offset, __n++) {              \
              __entry = (void *)(entries) + __i;            \
              __ret = fn(__entry);                          \
              if (__ret != 0)                               \
                 break;                                     \
     }                                                      \
     __ret;                                                 \
})

Does it use GCC extensions, or is it completely ANSI C compliant?

I understand what the macro is doing, but I don't understand the last line (__ret;). What exactly is it for?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Mark
  • 6,052
  • 8
  • 61
  • 129

0 Answers0