From owner-freebsd-arch@FreeBSD.ORG Wed Dec 22 18:51:56 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D7C1116A4CF; Wed, 22 Dec 2004 18:51:56 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7873143D49; Wed, 22 Dec 2004 18:51:56 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.13.1/8.13.1) with ESMTP id iBMIpV5a023669; Wed, 22 Dec 2004 11:51:32 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 22 Dec 2004 11:51:55 -0700 (MST) Message-Id: <20041222.115155.71839775.imp@bsdimp.com> To: scottl@freebsd.org From: "M. Warner Losh" In-Reply-To: <41C9C015.7050706@freebsd.org> References: <34cb7c8404122205002bd7de18@mail.gmail.com> <20041222.113411.76074974.imp@bsdimp.com> <41C9C015.7050706@freebsd.org> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: grog@freebsd.org cc: PeterJeremy@optushome.com.au cc: peadar.edwards@gmail.com cc: arch@freebsd.org Subject: Re: Header files with enums instead of defines? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2004 18:51:57 -0000 In message: <41C9C015.7050706@freebsd.org> Scott Long writes: : M. Warner Losh wrote: : > In order to gain the benefits of the enums, errno would need to be an : > enum errno_t or some such. This breaks C++ code that sets errno = 0, : > since you can't assign integers to errno values. : > : > So even if you retained EBOGUS or whatever, this wouldn't work with : > C++. errno has to be an int to work there. : > : > Warner : : I think you might have missed that nothing was actually being declared : with the errno_t type, but rather the type was used as a cast for gdb. : It's a neat trick, but still a little cumbersome unless gdb was taught : about it or given some clever macros. Or better yet, just use the array of error values already compiled into the programs that strerror() formats for you (you don't need to use strerror, just sys_errlist[]). Warner