From owner-freebsd-current@FreeBSD.ORG Mon Jan 24 03:17:36 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 46A6416A4CE for ; Mon, 24 Jan 2005 03:17:36 +0000 (GMT) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [128.30.28.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id DC77F43D1D for ; Mon, 24 Jan 2005 03:17:35 +0000 (GMT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.9/8.12.9) with ESMTP id j0O3HYaa077138 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK CN=khavrinen.lcs.mit.edu issuer=SSL+20Client+20CA); Sun, 23 Jan 2005 22:17:34 -0500 (EST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.9/8.12.9/Submit) id j0O3HTGu077135; Sun, 23 Jan 2005 22:17:29 -0500 (EST) (envelope-from wollman) Date: Sun, 23 Jan 2005 22:17:29 -0500 (EST) From: Garrett Wollman Message-Id: <200501240317.j0O3HTGu077135@khavrinen.lcs.mit.edu> To: Matthias Andree In-Reply-To: References: <20050120192324.GA30862@uriah.heep.sax.de> <20050120205501.GA69123@nagual.pp.ru> <20050120211449.GC30862@uriah.heep.sax.de> <20050120214406.GA70088@nagual.pp.ru> <20050120222137.GE30862@uriah.heep.sax.de> <20050120224017.GA71573@nagual.pp.ru> X-Spam-Score: -19.8 () IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES X-Scanned-By: MIMEDefang 2.37 X-Mailman-Approved-At: Mon, 24 Jan 2005 12:43:30 +0000 cc: current@FreeBSD.ORG Subject: Re: Implementation errors in strtol() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jan 2005 03:17:36 -0000 < said: [Apologies for joining this discussion late; I was on vacation.] > I do not have a place of discovery handy, but wasn't POSIX explicitly > deferring in to the C standard and giving it precedence for any > conflicts between the C standard library and POSIX? POSIX/SUSv3 defers to C99. However, POSIX significantly extends C99 by explicitly defining behavior that C99 leaves undefined or implementation-defined. In places where C is silent, POSIX is free to make additional requirements on an implementation. In the specific case of errors, POSIX observes the following three principles (which you can find in the introductory material to either XSI or XBD, I forget which): - If POSIX says that function X "shall" set errno to a particular value when a particular condition holds, implementations have no freedom of action: they must detect that condition and set errno as specified. - If POSIX says that a function X "may" set errno to a particular value when a particular condition holds, implementations are free not to detect that condition, but if they do, they must set errno to that value. - Unless a function is specified as not setting errno, a function may set errno to any nonzero value, regardless of whether it succeeds or fails. It then follows that: - If a function detects an error condition which is not explicitly enumerated in the standard, and which is not explicitly excluded by the definition of that function, it may set errno to an implementation-defined value and return an error indication. -GAWollman