You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the first one, you can have a const i32 variable inside the function WINDOW_POS_LIMIT and WINDOW_WIDTH_LIMIT or something, and then use them instead of your magic numbers.
const do not take any place in memory or in the stack, they'll be replaced as is, much like defines in C.
Otherwise it looks good to me. The alternative would be to output a Result<(), SomeKindOfError>, so that the library user can see what could go wrong at compile without his program crashing in his face.
@Cobrand Thank you for your guidelines. I want to output a Result<(), WindowSetError> (I'll need to create an enum to achieve this), but wouldn't this break the API? Right now, some of these functions already return an IntegerOrSdlError.
No problem @Cobrand, I'm very busy lately but I'll get to this soon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR tries to address Issue #700 .
Remarks:
I'd like to get rid of the magic numbers here and create constants for these boundaries, what would be the best way to do this?
I've added custom messages to the assertions, I don't know if this is desirable or not.
Big plus, a MacOS system user that's able to test this would be awesome 😄.