Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework error_code internal data members #126

Open
pdimov opened this issue Sep 14, 2024 · 0 comments
Open

Rework error_code internal data members #126

pdimov opened this issue Sep 14, 2024 · 0 comments

Comments

@pdimov
Copy link
Member

pdimov commented Sep 14, 2024

Instead of

    struct data
    {
        int val_;
        const error_category * cat_;
    };

    union
    {
        data d1_;
        unsigned char d2_[ sizeof(std::error_code) ];
    };

it might be better to have

int val_;
void const* cat_; // error_category or std::error_category

which could both simplify the code (esp. when we transition the std::error_code case to (value, unknown_category)) and help with GCC false -Wmaybe-uninitialized positives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant