[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    IMPORTANT: Static objects are evil.
From:       Waldo Bastian <bastian () kde ! org>
Date:       2000-06-29 5:56:08
[Download RAW message or body]

Hiya,

Short version:
==========
Static objects are evil. Do not use them. If you really need a static object, 
use a static pointer instead. E.g. like this:

{
   ...
   static MyObject *my_static_pointer = 0;
   if (!my_static_pointer)
      my_static_pointer = new MyObject();
   ...
}


Long version:
==========

Static objects in DSOs (shared libraries) are not very well supported and 
currently cause segmentation faults on exit, after returning from main(), if 
the DSO containing the static object was unloaded (with dlclose) by the 
program.

Cheers,
Waldo
-- 
Make way, KDE/Linux is coming to a desktop near you!
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic