New implementation of re module

Wolfgang Rohdewald wolfgang at rohdewald.de
Thu Jul 30 09:18:27 EDT 2009


On Thursday 30 July 2009, MRAB wrote:
> So it complains about:
>
>      ++(RE_CHAR*)context->text_ptr
>
> but not about:
>
>      ++info->repeat.count
>
> Does this mean that the gcc compiler thinks that the cast makes it
> an rvalue? I'm using Visual C++ 2008 Express Edition, which doesn't
> complain. What does the C standard say?

I am not really a C expert but I found some links. Most helpful:
http://developer.apple.com/DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/C-Dialect-Options.html

(search -fnon-lvalue-assign)

so I did the conversion mentioned there. This works: 

--- _regex.c    2009-07-29 11:34:00.000000000 +0200
+++ n   2009-07-30 15:15:22.000000000 +0200
@@ -1459,7 +1459,7 @@
             if (text_ptr < (RE_CHAR*)context->slice_end && text_ptr[0] != '\n')
               {
                 context->node = node->next_1;
-                ++(RE_CHAR*)context->text_ptr;
+                ++*(RE_CHAR**)&context->text_ptr;
             } else
                 context = reject_context(state, context);
             break;


-- 
Wolfgang



More information about the Python-list mailing list