Re: GRegex
- From: Murray Cumming <murrayc murrayc com>
- To: Marco Barisione <marco barisione org>
- Cc: gtk-devel-list gnome org
- Subject: Re: GRegex
- Date: Tue, 24 Oct 2006 22:31:04 +0200
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.
[snip]
Do they need to reference count plain strings too?
--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]