
Michiel Salters wrote:
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Doug Gregor Sent: woensdag 9 februari 2005 17:23 To: boost@lists.boost.org Subject: Re: [boost] Wave C++ Review Begins Today - February 7, 2005
...
Even dereferencing *last could be a bug, if it is past-the-end. For iterators referencing contiguous memory (vectors and pointers only, as you've said), one would need to write
scanner.last = scanner.first + std::distance(first, last);
True, but that's an partial fix. For now, I've fixed that bug too in my vector<char> wrapper but it's becoming complex. I'm afraid someone will have to write re2cpp.
It is possible to use re2c generated code in a c++ context. However, to explain the current situation, the original re2c c++ lexer was actually written in pure C (thus the origin of the aq_* code), and it looks like Hartmut has only changed the minimum necessary to integrate it with Wave. Like he said, if it works, don't mess with it :-) I originally wrote the re2c c++ scanner as a benchmarking tool to compare performance of re2c/flex/SLex generated scanners. At the time re2c won by about a factor of 2 IIRC. I did it in C because my #1 goal was performance. I found it interesting that, using the exact same source, if I compiled it as C instead of C++, it was about 10% faster. But that was years ago with gcc 2.95.2, who knows how things would stand today? -- Dan Nuffer