GetDC(NULL), GetModuleHandle(NULL), etc.
Sun Sep 4 17:40:00 GMT 2005
Alexander Gottwald wrote:
> On Fri, 2 Sep 2005, Joe Krahn wrote:
>>GetModuleHandle(NULL) is also in several places. Maybe it's OK, but why
>>not use the hInstance global?
> Global variables are bad(TM). With GetModuleHandle(NULL) there is no need
> to maintain a global hInstance. The other reason is there is no WinMain
> which has the hInstance parameter. So you'd require to set the global
> hInstance somewhere else and you have to make sure this occurs before
> the first reference to hInstance. GetModuleHandle(NULL) was used explicitly
> to reduce complexity.
Globals are not really bad(TM), for things that really are global.
But, a redundant global is definitely bad, so the global hInstance
should be removed instead.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
More information about the Cygwin-xfree