Ok, curious error while building with Visual Studio Ultimate 2012 (probably issue with ANSI, unicode etc) in the code...
switch (input[index])
{
case 'א': // Alef Hebrew character
if (/*conditional*/)
{
// Do stuff.
}
break;
case 'ב': // Beth Hebrew character
if (/*conditional*/)
{
//Do stuff
}
break;
default:
{
//Do some other stuff.
}
break;
}
The second case parameter generates...
Error C2196: case value '?' already used
Simple fix if possible.
Assuming input
is an array of wchar_t
s, your problem is that you're comparing a wide character to a narrow character literal.
As PeterT said in the comments:
If you save the file as utf-8 encoded then
א
is0xD790
andב
is0xD791
, so ifinput[index]
is of type char both would try to match0xD7
.
That's why you're getting the error you mentioned.
(char
has enough space to store an ASCII value, and the rest is omitted)
You can fix this by prefixing your literals with a capital L
(turning them in to wide characters).
case L'א': // Alef Hebrew character
if (/*conditional*/)
{
// Do stuff.
}
break;
case L'ב': // Beth Hebrew character
if (/*conditional*/)
{
//Do stuff
}
break;
Also, you need to make sure your source file is saved with unicode encoding & your compiler knows how to work with that.
Alternatively, you can simply escape the unicode value like so:
case L'\u05D0': // Aleph Hebrew character
// ...
case L'\u05D1': // Beth Hebrew character
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With