[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnutls-dev] living without global variables
|
From: |
Bryan Henderson |
|
Subject: |
Re: [gnutls-dev] living without global variables |
|
Date: |
Thu, 22 Dec 2005 17:22:38 -0000 |
>These variables are constant during the lifetime of the application.
I didn't really mean to refer to those two root pointers as the global
variables -- the entire tree each points to is the global variable.
These trees are specifically designed (according to what I see in the
user's guide) to make separate sessions share stuff as it changes.
That's great for sessions that all belong to the same context, but
modules shouldn't be sharing with other modules inadvertently.
The most serious way that these "variables" change during the lifetime
of the application is when a piece (module) of the application does a
gnutls_global_deinit(). That would blow up some other module in the
same application that happens to be using gnutls.
In case it isn't clear what sort of "module" I'm talking about: I (and
plenty of others, I'm sure) want to distribute a programming library
that uses gnutls to provide some of its function. It should be
possible for my user to be blissfully ignorant of the gnutls stuff
going on inside the library, which means he doesn't worry about
initializing and deinitializing the gnutls library. His program may use
gnutls for its own purposes, and may use some other library that uses
gnutls under the covers like mine.
It's common in modern libraries to avoid process-global variables
completely as a matter of good programming style (it helps not only
with modularity but thread safety and recursion as well).
--
Bryan Henderson Phone 408-621-2000
San Jose, California
- [gnutls-dev] living without global variables, Bryan Henderson, 2005/12/21
- Re: [gnutls-dev] living without global variables, Nikos Mavrogiannopoulos, 2005/12/21
- Re: [gnutls-dev] living without global variables,
Bryan Henderson <=
- Message not available
- [gnutls-dev] Re: living without global variables, Bryan Henderson, 2005/12/24
- Message not available
- [gnutls-dev] Re: living without global variables, Simon Josefsson, 2005/12/25
- [gnutls-dev] Re: living without global variables, Bryan Henderson, 2005/12/25
- [gnutls-dev] Re: living without global variables, Nikos Mavrogiannopoulos, 2005/12/26
- [gnutls-dev] Re: living without global variables, Simon Josefsson, 2005/12/26
- Re: [gnutls-dev] Re: living without global variables, Bryan Henderson, 2005/12/26
- Message not available
- [gnutls-dev] Re: living without global variables, Simon Josefsson, 2005/12/28