> Date: Sat, 21 Jan 2023 17:18:14 +0800 > Cc: g...@hazardy.de, gcc-patches@gcc.gnu.org, g...@gcc.gnu.org > From: LIU Hao <lh_mo...@126.com> > > 在 2023-01-21 12:05, Eli Zaretskii via Gcc 写道: > > I'm not sure I follow the logic. A program that calls > > GetModuleHandleW will refuse to start on Windows that doesn't have > > that API. So any version before XP is automatically excluded the > > moment you use code which calls that API directly (i.e. not through a > > function pointer or somesuch). > > Are _you_ still willing to maintain backward compatibility with Windows 9x? > Even mingw-w64 has been > defaulting to Windows Server 2003 since 2007. Why would anyone build a modern > compiler for such old > operating systems?
I'm only saying that we should not deliberately break those old platforms unless we have a good reason. And I see no such good reason in this case: GetModuleHandleA will do the job exactly like GetModuleHandleW will. > With any Windows that is modern enough, wide APIs should always be preferred > to ANSI ones, > especially when the argument is constant. Almost all ANSI APIs (the only > exception I know of is > `OutputDebugStringA` which does the inverse) translate their ANSI string > arguments to wide strings > and delegate to wide ones, so by calling wide APIs explicitly, such overhead > can be avoided. The overhead is only relevant in code that is run in performance critical places. I don't think this is such a place.