On 2010/08/07 19:18, Ronald Oussoren wrote:

On 7 Aug, 2010, at 10:24, Hirokazu Yamamoto wrote:

This is the idea just popped up. :-)

#define SIG(name) if (sig_num != SIG##name)
    SIG(ABRT) SIG(FPE) SIG(ILL) SIG(INT) SIG(SEGV) SIG(TERM) {
         PyErr_SetString(PyExc_ValueError, "signal number out of range");
         return NULL;
     }
#undef SIG

What's wrong with:

switch (sig_num) {
case SIGABRT:
case SIGFPE:
...
case SIGTERM:
        break;
default:
       PyErr_SetString(...)
       return NULL;
}

That would IMO be clearer than the macro you propose.

Ronald

Hmm... I liked the macro idea, but nothing is wrong with switch
statement.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to