From kde-devel Thu Jun 29 05:56:08 2000 From: Waldo Bastian Date: Thu, 29 Jun 2000 05:56:08 +0000 To: kde-devel Subject: IMPORTANT: Static objects are evil. X-MARC-Message: https://marc.info/?l=kde-devel&m=96225816819316 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 <<