[Python-Dev] Re: [Python-checkins] python/dist/src/Include object.h, 2.121, 2.122 boolobject.h, 1.4, 1.5

Alex Martelli aleaxit at yahoo.com
Sun Oct 19 18:31:32 EDT 2003


On Sunday 19 October 2003 11:40 pm, Brett C. wrote:
 ...
> #define Py_RETURN_FALSE do {Py_INCREF(Py_False); return Py_False;} while (0)
>> Isn't {Py_INCREF(Py_None); return Py_None} enough? I thought ending a
> curly brace with a semi-colon is harmless (equivalent of a NO-OP). Why

Not in C: the extra semicolon is an empty statement. So, for example
 if(...) {
 } ; else 
is a syntax error.
> bother with the do/while loop?

To let the user put a semicolon after the macro and get correct C code.
Alex


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /