Re: GRegex

On Tue, 2006-10-24 at 22:05 +0200, Marco Barisione wrote:
> Il giorno mar, 24/10/2006 alle 13.17 -0400, Dominic Lachowicz ha
> scritto:
> > 1) Please don't name variables 'string', as there may be a conflict
> > with C++'s std::string
> I think they were called "string" in the original version of GRegex
> written by Scott Wimer in 1999. PCRE calls the string "subject".
> However it's not a problem with C++, this program is valid:
> #include <string>
> #include <iostream>
> using namespace std;
> int main ()
> {
>   string string = "hello";
>   cout << string << endl;
> }

It's not necessary to challenge every compiler and every build
environment with that. A rename is easy.

> > 2) I noticed that there are g_regex_ref/unref() methods. Why did you
> > choose to do this, rather than subclass GObject? You would also then
> > have easy GObject-style accessors for the regex's "pattern" and
> > "match_options".
> The original plan was to include directly GRegex in GLib, so it cannot
> depend on GObject. This could be changed if we decide to include GRegex
> in a separate library.
> However is really necessary to have a real object?
> I added _ref and _unref because the only two programs that are currently
> using my modified version of EggRegex are GtkSourceView and MooEdit.Both
> programs need reference counting for regular expressions.

Do they need to reference count plain strings too?

Murray Cumming
murrayc murrayc com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]