The behavior of unlink and many other functions has been changed in
version 7.0 of Octave. This is well documented. Here is an excerpt of
the file etc/NEWS.7.md:
There are two documentation issues here. First, this is not what the manual says:
-- : unlink (FILE)
-- : [STATUS, MSG] = unlink (FILE)
Delete the file named FILE.
If successful, STATUS is 0 and MSG is an empty string. Otherwise,
STATUS is -1 and MSG contains a system-dependent error message.
See also: *note delete: XREFdelete, *note rmdir: XREFrmdir.
As you can see, nowhere is it mentioned that unlink may throw an error
when called without a return value.
Moreover, the NEWS file that you cited mentions a difference in command
form versus functional form, but that is not the issue. In fact, my
old program uses a functional form, and yet:
octave> unlink("nonexistent_file")
error: unlink: operation failed: No such file or directory
So both the manual and the NEWS file need to be corrected and should
state that unlink (and others) may throw an error unless they are
called with at least one return value.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 480 |
Nodes: | 16 (2 / 14) |
Uptime: | 250:10:01 |
Calls: | 9,532 |
Files: | 13,650 |
Messages: | 6,137,941 |