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

Re: Object Orientation in GTK



I will happily fire up EGCS and start using gtk-- as soon as it hits 1.0
status. For now, I've dug out my copy of K&R and am developing in gtk+
1.0.6, because I'm more confident that it's not a moving target. Are
there any other C++ holdouts in the same boat as me?

-Manni

SEGV wrote:
> 
> Havoc Pennington wrote:
> >
> > On Sun, 8 Nov 1998, Matthew Ettus wrote:
> > >
> > > Isn't this essentially like global variables?  Just because you throw
> > > them all into a structure, it is essentially the same, right?
> > >
> >
> > Not if you use the structure like an object. You don't declare it
> > globally; you have a constructor, my_object_new(). You then come up with
> > well-defined accessors and you have to have the discipline to stick the
> > them, because C won't keep you from doing the wrong thing.
> >
> > (Though you can use the public/private trick as seen in Gdk:
> >
> >  foo.h:
> >
> >   struct Foo {
> >     int public_member;
> >   };
> >
> >  foo.c:
> >
> >   struct FooPrivate {
> >    struct Foo;
> >    int private_member;
> >   };
> >
> >   void foo_method(Foo* f)
> >    {
> >     pf = (FooPrivate*)f;
> >     ...
> >    }
> >
> > )
> >
> > You get the idea. If you stick to the accessors and use dynamically
> > allocated objects, you can have OO code, as Gtk does. There's no reason
> > you have to use global variables. Though in many cases they are a fine
> > thing to use.
> >
> > Most of the code in Gnome CVS uses this Gtk-influenced style.
> >
> > Havoc
> 
> Um, isn't this a little overboard? Why can't (the collective) we stop picking at
> our scabs and just use C++?
> 
> For the last few years, whenever I use C I always end up reinventing the wheel:
> objects, dynamic function calling, access protection, etc.
> 
> Why not just let the compiler do it for you? I mean, I had to laugh when I read
> this email. This is so... primitive. Sure, it can be done, but why punish
> ourselves?
> 
> Just thoughts from a C++ friendly developer. We now return to our regularly
> scheduled programming.
> 
> --
> SEGV    http://www.cgocable.net/~mlepage/
> 
> --
>          To unsubscribe: mail gtk-app-devel-list-request@redhat.com with
>                        "unsubscribe" as the Subject.
> 
>         Mailing list concerns should be mailed to <listmaster@redhat.com>

-- 
------------------------------------------------------------------
Manni Wood, Senior Programmer/Analyst, Strategic Interactive Group
800 Boylston Street, Boston, MA, 02199
ph 617 867 1881 . fx 617 867 1111 . mwood@sig.bsh.com

    "A journey of a thousand miles must begin with a single step."
                                                         -- Lao-zi



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