I want to define a struct:
struct error
{
int errno;
/* other information */
};
And then I want my code to have error paths that look like this:
struct error my_error;
my_error.errno = errno;
/* set other fields on the error */
But if the same translation unit includes #include <errno.h>, then errno is normally a macro which gets replaced with something else.
Assuming you actually need to access errno in that translation unit so you can't just undefine it, is there a way to still have that struct field name?
I don't care if it's by suppressing the expansion for a specific token, or by somehow getting the errno token to get generated by other macro expansions which don't then expand further, or whatever method.
Ultimately it doesn't matter and I can just name the field something else like error or error_number instead. I just don't like being unable to name things what seems to be the most appropriate name.