This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 5/6] Make error_t an enumeration on all supported OSes.

Joseph Myers <> writes:

> On Wed, 14 Jun 2017, Florian Weimer wrote:
>> Zack Weinberg <> writes:
>> > We could conceivably change __errno_location to return an error_t,
>> > which would mean 'p errno' in GDB would print symbolic values without
>> > needing to cast it, but I hesitate to make the apparent type of errno
>> > not be 'int'.
>> That sounds a bit hackish because I'm not sure int * and error_t * are
>> types with that level of compatibility.
> Type compatibility is not transitive, and errno is required to have type 
> int.  Thus, if enum foo is an enum whose type is compatible with int 
> (following the implementation-defined rules for what integer type an enum 
> is compatible with), then _Generic (errno, enum foo: 0) is a valid C11 
> expression, which would not be valid if errno had an enum type other than 
> enum foo (two enum types compatible with the same integer type are not 
> compatible with each other).

Wow, interesting.

Perhaps a GDB plugin would be a better way to add this functionality?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]