Re: [GnomeMeeting-devel-list] [PATCH] removes unneeded begin/end call notification in text-chat



Le sam 24/01/2004 à 18:28, PUYDT Julien a écrit :
> On sam, 2004-01-24 at 17:40, Damien Sandras wrote:
> 
> > That's exactly the way it is currently in most cases.
> 
> Hmmm... src/common.h has quite a few exceptions...
> 


I strongly disagree.

> > You will never see that. Global variables, even static, are considered
> > as a very bad programming practice by many people, including me and I
> > have put much effort to prevent that to happen.
> 
> What I described is not _global_. It is _local_: you don't have access
> to the variables outside of the scope where they're used, and there's an
> outside the scope.
> 

No they are global in the sense that they are declared outside of the
scope of a function in a .cpp file. Having them declared as static
basically doesn't change anything to that fact.

> On the contrary, variables in a struct that is declared globally, with a
> function that gives access to it globally, are therefore _global_:
> there's no scope where you can't access them.
> 

huh? You are redifining terms your way ;-)
The big difference here is that you have only *defined* the structure.
You have not instancied the structure and so you don't have a global
reference to the structure. A structure is like an object, defining it
doesn't create it. 

But with your static-based approach you are clearly defining variables
that are global to a file.

Though I agree on one point, the GmTextChat definition (for example)
should be moved from common.h to chat_window.h. The reason of the
existence of common.h is historic, and we should get rid of that file in
the future.

> I agree that global variables should be avoided at all cost.
> 

Yes, and you won't get me accept static global variables in any file of
GnomeMeeting. There is even no need to discuss it or to try to convince
me. That is my point of view and part of my Coding Policy.

> > I know several projects using this, but my formation psychologically
> > refrains me from doing so. I will be very clear about this :
> > - either a GObject is used
> > - or you define structures like it is now
> 
> I'll push things into shape as much as possible through the use of
> structures if you wish so, since it will be a prerequisite for the clean
> transition to a GObject anyway, if it happens.
> 
> > But you will never see semi-global static variables in any file of
> > GnomeMeeting, because it is nearly as bad as GOTO programming.
> 
> Goto can be used for readability reasons. And can be used to make a
> program unreadable.
> 
> Snark
> 
> _______________________________________________
> Gnomemeeting-devel-list mailing list
> Gnomemeeting-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnomemeeting-devel-list
-- 
 _      Damien Sandras
(o-     
//\     It-Optics s.a.
v_/_    GnomeMeeting: http://www.gnomemeeting.org/
        FOSDEM 2004:  http://www.fosdem.org
        H.323 phone:  callto:ils.seconix.com/dsandras seconix com




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