home *** CD-ROM | disk | FTP | other *** search
- From: guy%gorodish@Sun.COM (Guy Harris)
- Date: 29 Jan 87 07:12:50 GMT
- Reply-To: guy@sun.UUCP (Guy Harris)
- Organization: Sun Microsystems, Mountain View
-
- > While we're it, make "cmp" call the first character in a file 0.
- >At least on my 4.2BSD system, cmp says the first character in a file is 1.
-
- "cmp" hasn't changed a lot, so all the other AT&T-derived "cmp"s do
- this.
-
- >I would imagine most people only use cmp to test for equality of files, but
- >I had reason to use the output of "cmp -l" the other day in a shell script
- >and got burned my this. Most likely, somebody needs to carefully go
- >through every command in the book and ferret out count from 0/1 problems.
-
- If people actually use the output of "cmp" in shell scripts, you
- can't just "make 'cmp' call the first character in a file 0", since
- this may break shell scripts. You do, however, have to document
- whether it calls that byte 0 or 1, and you also have to document
- precisely the format of its output, so you *can* use it in shell
- scripts.
-
- > Along those lines, what does it mean when some processor says
- >"error in line 0, file foo"? On the one hand, it makes computer sense to
- >call the "first" line/character/block/whatever of a file 0.
-
- For characters and blocks, maybe. For lines, it may make computer
- sense, but not a lot of sense otherwise. Text editors currently call
- the first line line 1, and even people exposed to C for prolonged
- periods of time do so as well (probably because their text editor
- does...).
-
- >On the other hand, it is very convienent to reserve "error in line 0" to
- >mean "something went wrong before I even got a chance to start reading the
- >file."
-
- Convenient for the programmer writing the code printing the error
- message, maybe, but that doesn't count. What counts in this case is
- convenience to the *user*, and an error message that leaves the line
- number out entirely - and even the file name, if the error doesn't
- pertain to the file - is far more convenient there.
-
- When some program says "error in line 0, file foo", it generally
- means the programmer who wrote that code was too lazy to get the
- error message right.
-
- Volume-Number: Volume 9, Number 38
-
-