Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win32 method name conventions? #2335

Closed
LPGhatguy opened this issue Aug 9, 2015 · 1 comment
Closed

Win32 method name conventions? #2335

LPGhatguy opened this issue Aug 9, 2015 · 1 comment
Labels
question Issues that look for answers. windows Issues and PRs related to the Windows platform.

Comments

@LPGhatguy
Copy link
Contributor

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?

@thefourtheye thefourtheye added question Issues that look for answers. windows Issues and PRs related to the Windows platform. labels Aug 9, 2015
@bnoordhuis
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that look for answers. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

3 participants