Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

Macro iterating and returning value [duplicate]

$
0
0

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?


Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>