GeezerVison is showing github.com — Win32 method name conventions? · Issue #2335 · nodejs/node
Win32 method name conventions? #2335
Labels
questionIssues asking questions about Node.js.windowsIssues and PRs related to the Windows platform. Description
Looking through the Windows-specific code, I see lots of instances of *W (like GetVersionW) methods called explicitly, which forces wide characters. Typically I'd expect use use of undecorated names like GetVersion, which lets the compiler configure for or against wide character support (and is future proof!)
See: https://github.com/nodejs/io.js/blob/master/src/node_os.cc#L96
Is there any reason why the code is written this way?
There was a commit from @piscisaureus that describes a change from GetVersionA to GetVersionW -- should calls like this be changed again to just GetVersion?
Activity
bnoordhuis commented on Aug 9, 2015
It's intentional. It aligns with libuv (which always uses wide character APIs) and it avoids incompatibilities between different io.js versions and configurations.
Turn the question around: why not write it this way? The ANSI versions exist for backwards compatibility but for any new program (where 'new' means 'written in the last 15 or 20 years') there really is no reason not to use the wide character versions.
Closing, hope this answers your question.
Metadata
Metadata
questionIssues asking questions about Node.js.windowsIssues and PRs related to the Windows platform. Development
No branches or pull requestsIssue actions