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
  • 330,190
  • 66
  • 504
  • 555
Mark
  • 5,372
  • 6
  • 46
  • 103

0 Answers0