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

Re: global variables in shared libraries



On Thu, Jan 22, 2004 at 11:34:39PM +0100, martin f krafft wrote:
> My question is about global variables -- I know they are bad
> programming style, but when it comes to debugging or subsystem
> initialisation in C, they are sometimes really necessary.

I have never seen or heard of a valid use of global variables that
could not be done better without using globals. I don't know what
you're thinking of for debugging, but for initialisation you either
want __attribute__((constructor)), pthread_once(), or a combination of
the two.

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature


Reply to: