[issue10542] Py_UNICODE_NEXT and other macros for surrogates
Alexander Belopolsky
report at bugs.python.org
Sat Nov 27 03:20:45 CET 2010
Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:
On Fri, Nov 26, 2010 at 8:41 PM, STINNER Victor <report at bugs.python.org> wrote:
..
> I don't like macro having a result and using multiple instructions using the evil
> magic trick (the ","). It's harder to maintain the code and harder to debug than
> a classical function.
>
You are preaching to the choir. In fact, my first version
(issue10521-unicode-next.diff attached to issue10521) used a
function. I would not worry about implementation at this point,
though. Let's find the best abstraction first.
> Don't you think that modern compilers are able to inline the code?
> (If not, we may add the right C attribute/keyword)
Not in C. In C++, I could use a reference to the pointer incremented
by the macro, but in C, I have to use an address. Once you take an
address of a variable, the compiler will refuse to put it in a
register. So no, I don't think we can write an ANSI C function that
will be as efficient as the macro.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10542>
_______________________________________
More information about the Python-bugs-list
mailing list