Skip to main content
GameDev.net gamedev.net
🔒 Locked

wchar_t question.

Started by noxy Feb 6, 2012 at 3:50 PM 4 replies 1.9k views
Original Post
noxy
noxy
In my book called symfonia c++ author wrote:

wchar_t a;
a = L'b;


Does it mean that i must put (L) always before ('b') etc.?
I dont understand quite diffrent bettween L'b' and 'b'.
SiCrane
SiCrane
'b' is a regular char literal. Prefixing it with L makes it a wide character literal. The same deal with quotes. "b" is a regular char string. L"b" is the wide character string with equivalent contents.
Berkay
Berkay
when you write L you convert 16 bit your char
SiCrane
SiCrane

when you write L you convert 16 bit your char

No, it's not necessarily 16-bits. Most *nix systems use 32-bit wide characters.
noxy
noxy
So, i must use L always when i put value in variable with wchar_t type?
SiCrane
SiCrane
No, L is only used to prepend character literals and string literals to turn them into wide character literals and wide string literals. If you have a wchar_t variable you can assign it to another wchar_t variable without needing to use L on that assignment.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.