exception(logic error and runtime error)

T

Tony Johansson

Hello Experts!

I reading a book called programming with design pattern revealed
by Tomasz Muldner and here I read something that sound strange.

"Exception are divided into logic errors and runtime errors. Logic errors
represent static errors that
can be prevented and detected at compile time. Runtime errors represent
dynamic errors that can be detected only at runtime."

Now to my question what does it mean with "Logic errors represent static
errors that
can be prevented and detected at compile time." The compiler will not detect
if you index out of range
in an array so why does it then say that Logic errors represent static
errors that
can be prevented and detected at compile time. It exist an logic_error class
exception that has name out_of_range.

Many thanks

//Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top