Skip to content

Explicit Enums#37

Merged
dmadison merged 2 commits intomasterfrom
enums
Jul 25, 2020
Merged

Explicit Enums#37
dmadison merged 2 commits intomasterfrom
enums

Conversation

@dmadison
Copy link
Copy Markdown
Owner

Making some implicit things explicit in order to indicate intent, and make sure these are consistent between different builds and configurations.

Originally I started this branch to create a None option for the XInputReceiveType to take care of a meta programming issue where you don't have a "NULL" option for a volatile flag taken from the arguments for a receive callback. But after much hemming and hawing I decided against it, as there is no known "safe" value that is guaranteed to be unused, and the user can always use a larger type like a signed int with -1.

dmadison added 2 commits July 25, 2020 01:39
This should be implicit given the provided values, but I'm making it explicit here to indicate intent (using a single byte from the USB data) and match usage elsewhere such as the receive() function.
Again, not really necessary because these should be implicit given the previous values and the type. But making them explicit to indicate intent.

Using numbers indexed from 0 here to allow the user to do a for loop to set all of the buttons from say a packed 16-bit value.
@dmadison dmadison merged commit 4613ca7 into master Jul 25, 2020
@dmadison dmadison deleted the enums branch July 25, 2020 06:38
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

Successfully merging this pull request may close these issues.

1 participant