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

List:       kde-core-devel
Subject:    Re: IMPORTANT: Static objects are evil.
From:       Stephan Kulow <coolo () kde ! org>
Date:       2000-06-29 8:07:44
[Download RAW message or body]

Waldo Bastian wrote:
> 
> Hiya,
> 
> Short version:
> ==========
> Static objects are evil. Do not use them. If you really need a static object,
Static QObjects? A QString shouldn't be the problem if it's local to a
function

Greetings, Stephan

> 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!

-- 
... but you ain't had mine

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

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