Is it possible to have a warning when a multicharacter constant is used in MSVC? (Something similar to -Wmultichar in gcc). Or if there is any alternative solution to help find code like the following, please let me know.
Compiling with W4 on this code failed to produce any warnings while with gcc I could produce -Wmultichar and -Wtype-limits:
int main()
{
std::string s = "hello";
if (s[0] == 'he') {}
}
(I’m aware of Wall but that produces so many warnings I didn’t bother with it.)
Only in limited contexts – for the following code, there are two warnings:
These warnings could be enabled individually without enabling
/W4or/Wall.However, for the code in your question, there are no applicable warnings, even with
/Wall.