K_GLOBAL_STATIC and other macros

Thomas Zander zander at kde.org
Fri Apr 13 10:19:44 BST 2007


I've been looking for a way to do statics since the kde3 method has been 
deprecated. Unfortunately the only code example I found doesn't contain 
enough information for me to figure how the macro applies to me (or even 
how in general it works).

Thats a generic problem with macros; they are not documented in our API 
docs and in general you need a lot more then api docs anyway since their 
usage tends to need more info than a generic method.  Its more in the 
reach of class-docs in that there are quire some usages.

I'd like to propose that someone who understands the above macro, and 
maybe others, either write here or create a page on techbase to explain 
usages so I can start using those cool things you guys created.

The only doc I found so far is: 
http://techbase.kde.org/Development/Tutorials/Common_Programming_Mistakes#Static_variables
which does not tell me how to implement the singleton pattern using the 
macro.
I'm looking for a way to;
init the static to zero initially;
Define a method like 'instance' or 'self' that either returns an existing 
one or creates a new one including some initialisation code.

Thanks!
-- 
Thomas Zander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070413/343597c1/attachment.sig>


More information about the kde-core-devel mailing list