0
when compiler knows where is semicolon is missing, then compiler should put the semicolon instead of showing a error ?
2 Antworten
+ 1
No, because the compiler doesn't really know that a semicolon is missing most of the time and is simply expecting to see one somewhere due to some other syntax error in the code that the programmer has made by typing in or omitting some other operator. IE a misplaced (, ), or {, } etc. Often you will see that the compiler will show an error in the code somewhere other than where it actually is. May only be off by a line or so, but that is more than enough to cause more harm than having it insert a semicolon somewhere that it wasn't intended.
+ 2
Compiler has the ability to optimize your code but that doesn't mean it will correct the errors made by you.