0

when compiler knows where is semicolon is missing, then compiler should put the semicolon instead of showing a error ?

18th Apr 2020, 12:14 PM
Anil Swami
Anil Swami - avatar
2 Réponses
+ 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.
18th Apr 2020, 2:36 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Compiler has the ability to optimize your code but that doesn't mean it will correct the errors made by you.
18th Apr 2020, 12:20 PM
Avinesh
Avinesh - avatar