Skip to content

Enums as seperate integer types instead of aliases#4

Merged
Free-Pascal-meets-SDL-Website merged 12 commits intoPascalGameDevelopment:masterfrom
suve:enums-as-seperate-integer-types-instead-of-aliases
Aug 1, 2021
Merged

Enums as seperate integer types instead of aliases#4
Free-Pascal-meets-SDL-Website merged 12 commits intoPascalGameDevelopment:masterfrom
suve:enums-as-seperate-integer-types-instead-of-aliases

Conversation

@suve
Copy link
Collaborator

@suve suve commented Jul 25, 2020

This changeset converts some of the enum types encountered in the headers from simple aliases to separate types. By utilising the type X = type Integer feature present in FPC, it informs the compiler that the numerical types should be considered separate and, without an explicit last, it should be impossible to assign a value from enumA to enumB.

Things to consider:

  • Are there any more functions that have e.g. SInt32 as an argument / return type, where they should name a specific enum?
  • Does this also work as intended in Delphi?

@Free-Pascal-meets-SDL-Website
Copy link
Collaborator

I do not see any problem with this PR.
Should work the same in Delphi.

… 'master'

Merge conflicts:
- sdlblendmode.inc
@Free-Pascal-meets-SDL-Website
Copy link
Collaborator

Hey suve, is this finished?

I do not see any problems with this.

Regards Matthias

@Free-Pascal-meets-SDL-Website Free-Pascal-meets-SDL-Website merged commit 8fda99e into PascalGameDevelopment:master Aug 1, 2021
@suve suve deleted the enums-as-seperate-integer-types-instead-of-aliases branch November 16, 2022 15:24
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.

2 participants