Skip to content

Conversation

@elachlan
Copy link
Contributor

@elachlan elachlan commented Aug 24, 2022

This overrides ToString() to produce the familiar 0x80001234 format for an HRESULT.
It also adds the HRESULT_FROM_WIN32 macro.

Fixes #664

@elachlan
Copy link
Contributor Author

I am unsure what to do to fix the build error. Do I need to specify a dependency somewhere?

Also ensure invariant formatting of the HRESULT
As a member of the HRESULT struct, it caused the otherwise small HRESULT struct to also generate the very large `WIN32_ERROR` enum, even if the user wouldn't have used this function.
So instead, we start a new concept where 'macros' such as this can be defined as a template, and then requested for generation explicitly. The generator is smart enough to detect what types the macro uses and generate them as well, as proven by the new test.
@AArnott
Copy link
Member

AArnott commented Sep 6, 2022

I refactored the HRESULT_FROM_WIN32 into its own optional 'macro' (a new concept) so that WIN32_ERROR doesn't always have to be (exhaustively) generated every time HRESULT is required.

@AArnott AArnott enabled auto-merge September 6, 2022 23:32
@AArnott AArnott added the enhancement New feature or request label Sep 6, 2022
@AArnott AArnott disabled auto-merge September 6, 2022 23:47
@AArnott AArnott enabled auto-merge September 6, 2022 23:49
@AArnott AArnott mentioned this pull request Sep 6, 2022
@AArnott AArnott merged commit ae4b609 into microsoft:main Sep 7, 2022
@elachlan elachlan deleted the HRESULT branch September 7, 2022 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvements to HRESULT

4 participants