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
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