I recently made a syntax mistake by writing this:
b = (float)a*0,1;
instead of:
b = (float)a*0.1;
I am surprised to find out that the first line don't even put a compilation error. I am even more confuse to see that the following line produce compilation error:
float b = (float)a*0,1;
Can someone explain me why the third line is a syntax error but not the first (in fact it is) ?
blahhas no effect), but when the compiler sees syntactically valid code, no matter how wrong-headed it may be logically, it compiles it.ais an integer you do not need the cast. And when you do need the cast you should rather use a proper onestatic_cast<float>(a)