This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [Hurd] error_t, E*, and c++
- From: Roland McGrath <roland at redhat dot com>
- To: Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- Cc: libc-alpha at sources dot redhat dot com, bug-hurd at gnu dot org
- Date: Mon, 26 May 2008 20:01:17 -0700 (PDT)
- Subject: Re: [Hurd] error_t, E*, and c++
- References: <20080525174517.GZ4632@implementation>
Hmm. You need at least "#define EFOO EFOO" to make "#ifdef EFOO" work.
But one of the reasons for the current style of definition is in
particular so that "#if EAGAIN != EWOULDBLOCK" works right. That can
only win if it's a cpp-interpretable expression, which cannot use enum
constants or syntax like casts. (The cpp rules mean that the enum
constants are unknown identifiers and treated as zero, so any EFOO ==
EBAR comparison says they are equal.) I am hesitant to risk breaking
any such #if expressions now compiled in C++ on Hurd. (The error_t
usage being broken in C++ is at least not a silent change or breakage of
something that already works.)
It may also be a problem in some other C++ way I'm not aware of off
hand, for the type of EFOO not to be int.
I'm open to suggestions. But I think we might just have to live with
C++ using (error_t) EFOO, or else supply a C++ <errno> or whatever where
there is explicitly no expectation of int-valued or cpp-usable values,
if people would actually use that.
Thanks,
Roland