GetDC(NULL), GetModuleHandle(NULL), etc.
Joe Krahn
jkrahn@nc.rr.com
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.
>
> bye
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.
Joe
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
More information about the Cygwin-xfree
mailing list