This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to predict a program containing compile time and run time error?  RSS feed

 
Raga Jana
Ranch Hand
Posts: 35
Google Web Toolkit Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is it possible to predict when seeing a program we can find out of which and all run time error and which and all compile time error.. If the question is wrong please make it clear!!

 
Edwin Torres
Ranch Hand
Posts: 57
Java Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "predict"? Some errors? 100% of the errors? I guess it depends on how long you review the source code and how good you are at spotting errors. If you understand how compilers work, you'll be able to find syntax errors. If you understand what a program is doing, you may find some runtime errors too. But this is all relative to how good you are at spotting errors.
 
Raga Jana
Ranch Hand
Posts: 35
Google Web Toolkit Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply..
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edwin Torres wrote:What do you mean by "predict"? Some errors? 100% of the errors? I guess it depends on how long you review the source code and how good you are at spotting errors. If you understand how compilers work, you'll be able to find syntax errors. If you understand what a program is doing, you may find some runtime errors too. But this is all relative to how good you are at spotting errors.


In addition to the points above, I believe the ability to accurately debug code on sight varies directly with the relative complexity of the source code to the viewer's own programming ability, compiler understanding, and overall experience.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Predicting all runtime errors is mathematically equivalent to predicting whether a program will ever terminate without running it; it has been rigorously proved that for the general case this is impossible!

Compile-time errors, on the other hand, can be found with a program that parses, but does not compile the program.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!