Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 415981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:26:05+00:00 2026-05-12T18:26:05+00:00

Why is wchar_t needed? How is it superior to short (or __int16 or whatever)?

  • 0

Why is wchar_t needed? How is it superior to short (or __int16 or whatever)?

(If it matters: I live in Windows world. I don’t know what Linux does to support Unicode.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:26:06+00:00Added an answer on May 12, 2026 at 6:26 pm

    Why is wchar_t needed? How is it superior to short (or __int16 or whatever)?

    In the C++ world, wchar_t is its own type (I think it’s a typedef in C), so you can overload functions based on this. For example, this makes it possible to output wide characters and not to output their numerical value. In VC6, where wchar_t was just a typedef for unsigned short, this code

    wchar_t wch = L'A'
    std::wcout << wch;
    

    would output 65 because

    std::ostream<wchar_t>::operator<<(unsigned short)
    

    was invoked. In newer VC versions wchar_t is a distinct type, so

    std::ostream<wchar_t>::operator<<(wchar_t)
    

    is called, and that outputs A.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for example, does: wchar_t x; translate to: unsigned short x;
Suppose I have this Windows wchar_t string: L\x4f60\x597d and L\x00e4\x00a0\x597d and would like to
I want to output some wchar_t array filled from some windows api into a
Note: /* * Trivial code */ wchar_t *greeting = LHello World!; char *greeting_ =
I was playing around with unicode characters (without using wchar_t support) just for fun.
Is there a portable wchar_t in C++? On Windows, its 2 bytes. On everything
SimpleIni Documentation says wchar_t is supported but I don't understand how to use it.
So Qt is compiled with /Zc:wchar_t- on windows. What this means is that instead
What does this do? const wchar_t *s = Ltest; If wchar_t is two bytes
Is the wchar_t type required for unicode support? If not then what's the point

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.