If the compiler can detect there is a semicolon missing in line 42 , then why just it can't put a semicolon itself? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

If the compiler can detect there is a semicolon missing in line 42 , then why just it can't put a semicolon itself?

🤔🤔🤔

19th Jan 2020, 8:37 AM
Ambitious Coder
Ambitious Coder - avatar
3 Answers
+ 4
Because it doesn't know if the semicolon missing is the real problem or if it is generated by another mistake somewhere else
19th Jan 2020, 9:09 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 4
Compilers's errors or warning aren't there for nothing. They are here to tell you that something went wrong on a specific line. Even if it knows what's the mistake, it isn't his job to correct it. Else, it would create even more errors, because it doesn't know in which way you've implementing your solution. Imagine a compiler saying : 'Error, print is not defined, did you mean printf' => then the compiler replace print with printf. In fact, you really want to call a function named print, but you forgot including the right header. Then, all your code is false and you have to correct the compiler's correction manually : that's not worth!
19th Jan 2020, 2:10 PM
Théophile
Théophile - avatar
0
Well even if it could add the semi colon , it would take more time as usual
25th Dec 2020, 7:59 PM
__k_maaz__ [ INACTIVE ]
__k_maaz__ [ INACTIVE ] - avatar