c++ - What does it mean when a char or wchar_t == -1? -


Why would it compare the value of a character in the visual studio (the first one four, now a wchar_t) -

1?

I have many illegal checks against 1:

  TCHAR ch; ... if (f == - 1)   

the coverage is telling me that "ch == -1" is always false regardless of its operand value. "

Now, it was originally written to use four values ​​instead of wchar_t, and it was upgraded when Unicode support was needed. I need to know that Checking against "four f;" 1 so that I can do a similar test against wchar_t.

Integer constant EOF is usually defined for -1 if it indicates what your code is checking (where On ch has come), then related to wchar_t comparison WEOF and looks like a suitable Windows TCHR macro. / P>

PS: Fully told in the comments, as the value was changed to char or wchar_t , it would be sent to EOF Or is too late to compare with WEOF : Many encodings use four '\ xff' as a valid letter, and such Converse After the loan, the code can be different from the EOF itself: the variable ch type int / wint_t for any type of comparison / _TINT must be valid.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -