Manager* g_Manager = NULL;
wxConfigBase* g_Config = NULL;
TemplateManager* g_TemplateManager = NULL;
PluginManager* g_PluginManager = NULL;
EditorManager* g_EditorManager = NULL;
MacrosManager* g_MacrosManager = NULL;
MessageManager* g_MessageManager = NULL;
ProjectManager* g_ProjectManager = NULL;
ToolsManager* g_ToolsManager = NULL;
Actually, you would use 0 rather than NULL which is defined as ((void*)0).
...Should I use the first, because the latter would pollute the global namespace whenever the #define won't?if you are born past 1977 use the latter :)
I only mentioned it because when I did a search in files for g_EditorManager, I did not see an immediate place where it was always initialized. If it was initialized at the declaration it would have saved me a bit of time because there would be no doubt.It is a hack for MSVC++ to cope with the manager singletons.
And there is any way to not use macros in cases of compile time options (like #ifdef USE_UNICODE and such)?#pragma once
if it wants to survive from people going out to new languages like Java, Phyton, C#, etc.Not true, the language features are all there, people are only too lazy to use them.
so I can deduce the autor was born before 1977 :PI was too ... and I still use const vars except when I really have to :)
About NULL pointer, I have found the following FAQ (http://www.xploiter.com/programming/c/cnull.shtml), answer (http://www.research.att.com/~bs/bs_faq2.html#null), topic (http://www.codecomments.com/archive272-2004-7-242810.html) and article (http://en.wikipedia.org/wiki/Null_pointer) rather interesting.
Michael
I agree that 0 looks like an integer and NULL distinguishes pointer initialization from integer initialization. On that basis alone I will always have state to use NULL for pointers in my style guidelines for any project I create. I'm also a grown up, so if I know that someone else's guidelines specify something different, I will follow them with the same respect I would expect them to treat my rules with if they were helping on my projects.
Has anyone of you noticed that wxWidgets uses NULL ?
#define NULL 0
#define if(x,y) while(x){(y) break;}