home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.wizards
- Path: sparky!uunet!mcsun!Germany.EU.net!murignis!ap542!D012S436!frank
- From: frank@D012S436.sniap.mchp.sni.de ()
- Subject: Re: A few UNIX questions
- Message-ID: <1992Sep8.164706.9819@sniap.mchp.sni.de>
- Sender: news@sniap.mchp.sni.de (News Admin)
- Organization: Siemens-Nixdorf AG
- References: <169@sc.sni.ie>
- Date: Tue, 8 Sep 92 16:47:06 GMT
- Lines: 44
-
- bsullivn@sc.sni.ie (Bryan O'Sullivan) writes:
- : frank@D012S436.sniap.mchp.sni.de writes:
- :
- : ::Because lseek() needs to be able to return -1 on error, and not have it
- : ::look like a valid file offset.
- :
- : :Umm, and a *signed* file size helps, does it?
- :
- : RTFM. Lseek(2) returns the current position in the file, or -1 on
- : error. If you can think of any way to produce -1 by using unsigned
- : values, well ...
-
- UYFH (Use Your F****** Head :-)
-
- Hint: The manual describes things as they are, not as they have to be.
-
- Firstly, There are other ways to signal the error:
-
- 1: (unsigned long) -1 works fine, and you only lose one value, instead of
- half the value space.
-
- 2: If casting upsets you, you can define an ERROR constant as being
- the maximum unsigned, for example, and have the same thing going
- for you.
-
- 3: 'errno' can be used to signal the error.
-
- Secondly, even if there were no other way to signal the error,
- there is no need to considere the file offset stored *on the
- disk* as being signed - it's not - a file's size is never negative.
-
- :
- : -- Bryan
- :
- : --
- : Bryan O'Sullivan +353-1-767551 x225
- : Siemens-Nixdorf Informationssysteme AG bryan@sc.sni.ie
- : Software Development Centre "Theory like mist on eyeglasses.
- : Dublin Obscure facts." -- Charlie Chan
- --
- Frank O'Dwyer Disclaimer:
- Siemens-Nixdorf AG I will deny everything
- Tel. : +49 (89) 636-40639 Fax. : +49 (89) 636-45860
- e-mail: Frank.ODwyer@sniap.mchp.sni.de <--Use this, reply-to is broken
-