←back to thread

180 points beryilma | 3 comments | | HN request time: 0s | source
Show context
ctz ◴[] No.41908126[source]

  Runtime errors surface when a program
  runs into an unexpected condition or situation
  such as dividing by zero, memory overflow, or
  addressing a wrong or unauthorized memory
  location or device, or when a program tries to
  perform an illegitimate or unauthorized operation
  or tries to access a library, for example.
  The programs must be thoroughly tested for
  various types of inputs (valid data sets, invalid
  data sets and boundary value data sets) and
  conditions to identify these errors. Once identified,
  runtime errors are easy to fix.
Embarrassing horseshit.
replies(4): >>41908241 #>>41909426 #>>41909473 #>>41910499 #
dustfinger ◴[] No.41908241[source]
> or tries to access a library

I had to open the PDF and find this line to confirm. It really says that. It reads as if claiming that any program that accesses a library will then have a runtime error. That is obviously not what they intended, but I have read it over a few times now and cannot see another interpretation.

replies(1): >>41908484 #
TrueDuality ◴[] No.41908484[source]
That line is referring to shared libraries linked to a dynamic executable. If a shared library isn't installed or available you will receive an error similar to the following:

    $ ./main
    ./main: error while loading shared libraries: librandom.so: cannot open shared object file: No such file or directory 
Which is indeed a runtime error.

There is also the common use case of hot-reloading compiled code which dynamically loads and unloads shared libraries without restarting the entire application. It needs to be done carefully but you've likely used an application that does this. Failure to load a library, or loading an incompatible one will also create a runtime error.

Looks like there is a lot of bad generalizations in here, but they are technically correct on this one.

replies(2): >>41908584 #>>41908831 #
1. dustfinger ◴[] No.41908584[source]
I understand that is what they meant, but it is not what they wrote. They should have qualified the statement as you did, with the conditions that yield a runtime error. Even if they generalized those conditions that would have been fine.

for example:

  or tries to access a library that it is unable to for some reason without handling the resulting error.
replies(2): >>41909484 #>>41910267 #
2. wakawaka28 ◴[] No.41909484[source]
Ah, but the existence of a suitable library in the environment is assumed. So not having it is an unexpected condition.
3. eacapeisfutuile ◴[] No.41910267[source]
So… most likely it is a “typo” or edit-mistake or similar. If you understand what they meant then all is good, no?