[Hurd] error_t, E*, and c++

Roland McGrath roland@redhat.com
Tue May 27 11:45:00 GMT 2008


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



More information about the Libc-alpha mailing list