I’ve been fooling with the MSVC 2008 immediate window for the last few hours and I’m flabbergasted with both myself and Microsoft… It probably doesn’t help that I stumbled on this mystery at bedtime and it’s now 6 hours later. 🙂
Please see the following:
? "1234567\\87654321\\" CXX0026: Error: bad format string
I’ve tried the above several ways in the immediate window and… Nothing. No amount of backslashes gets rid of the error. Removing the backslashes is the only way to solve it.
Does the expression evaluator have something against double backslash in a wide string?
For what it’s worth, the immediate window fooling was motivated by the following:
Line 107 is:
size_t endpos = str.find_last_not_of( L”\\/” );
file.cpp(107) : error C2017: illegal escape sequence
file.cpp(107) : error C2017: illegal escape sequence
file.cpp(107) : error C2065: 'L”' : undeclared identifier
file.cpp(107) : error C2065: '”' : undeclared identifier
My questions are:
Beware of code that you copied off a website, maybe a blog post. The author may well have used a word processor, one that implements ‘smart quotes’. If you look closely at the first and the second line you’ll see the difference. Your compiler will only like the straight double-quotes.
It doesn’t quite explain your problem with the Immediate Window, it works when I try your string as shown. Maybe it doesn’t quite look like it either.