off_t (was unix question: files per directory)

Chris Torek chris at mimsy.UUCP
Thu Apr 13 22:48:01 AEST 1989


In article <1430 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
>since [lseek] can use [its off_t] argument ... as a
>possibly-negative offset relative to the current position in the file or
>to the end of the file, it has to be signed. 

Well, no, not really.  Unsigned arithmetic is modular arithmetic;
this produces the same result, although not in as intuitive a manner.
If (off_t) is (unsigned long) and if that is 32 bits, -(off_t)100 is
4294967196, and (off_t)150 + -(off_t)100 is 50.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list