hi,
in C the following gives an error:
enum boolean { YES , , // here , , NO };
in pike, multiple , in enum are ignored. is there a reason for that?
greetings, martin.
Yes, it's convenient when macros are used that might or might not expand to something nonempty.
ok,
i guess i can see the usefullness of that. although i don't like the use of the preprocessor to much. off your head, can you point to any examples in the pike source?
greetings, martin.
Not for enum specifically. However, I've written code like this many times:
#ifdef DEBUG #define DO_IF_DEBUG(X...) X #else #define DO_IF_DEBUG(X...) #endif /.../ int some_function (string a, array b, DO_IF_DEBUG(int debug_flag))
It's possible to cope with this situation anyway by moving the comma after "b" to inside the debug argument, but it gets uglier imo. On occasion it can become really tricky to get commas correct if the parser is strict about them.
pike-devel@lists.lysator.liu.se