Article View: mod.std.unix
Article #456Counting from 0
From: std-unix
Date: Wed, 28 Jan 1987 03:04
Date: Wed, 28 Jan 1987 03:04
31 lines
2140 bytes
2140 bytes
From: seismo!cmcl2!phri!roy@sally.utexas.edu (Roy Smith)
Date: Sun, 18 Jan 87 09:48:11 est
Organization: Public Health Research Inst. (NY, NY)
[ The square brackets below were apparently inserted by Roy Smith;
they were not added by the moderator. -mod ]
> From: colonel@sunybcs.UUCP (Col. G. L. Sicherman)
> Now, that [having tail count from 1 instead of 0 is] un-Unixican.
> Characters start at 0, and perhaps blocks and lines should too. As it
> is, if I want a shell command or expression in the argument, I usually
> have to add 1 to it to make it work.
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.
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.
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. 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."
--
Roy Smith, {allegra,cmcl2,philabs}!phri!roy
System Administrator, Public Health Research Institute
455 First Avenue, New York, NY 10016
Volume-Number: Volume 9, Number 24
Technical Details
Message-ID:
<6965@ut-sally.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!im4u!ut-sally!std-unixReferences:
<6882@ut-sally.UUCP> <6710@ut-sally.UUCP> <6783@ut-sally.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!im4u!ut-sally!std-unix From: std-unix@ut-sally.UUCP Newsgroups: mod.std.unix Subject: Counting from 0 Message-ID: <6965@ut-sally.UUCP> Date: Tue, 27-Jan-87 22:04:18 EST Article-I.D.: ut-sally.6965 Posted: Tue Jan 27 22:04:18 1987 Date-Received: Wed, 28-Jan-87 23:39:05 EST References: <6882@ut-sally.UUCP> <6710@ut-sally.UUCP> <6783@ut-sally.UUCP> Organization: IEEE P1003 Portable Operating System for Computer Environments Committee Lines: 31 Approved: jsq@sally.utexas.edu