-
Notifications
You must be signed in to change notification settings - Fork 20
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
Handle SDL_bool like a real boolean #30
Comments
C and Pascal handle booleans differently. In C they are basically integer values which are interpreted but in Pascal they form a special, separate type (or are at least treated as such). So, what follows from this:
So, for the example in the initial post it is correct to use the native |
For me, just change the declaration of type
TSDL_Bool = System.Boolean; and adopt all the code to the new type. Casting to native booleans should be avoided — the code should be adopted to the Pascal language, not to the C language. Additionally, some constant values should also be redeclared (eg. What do you think about it? |
The problem is that we need to maintain binary compatibility with the C library. According to the FPC Language Reference, We could consider using |
Exactly. After all, the same goes for the functions of the Win32 API, wherever the multibyte booleans are required. |
I added a PR (#70) to solve this issue according to you proposal using The code below works well, too now.
|
Change TSDL_Bool to equal cbool Closes issue #30
Closed by PR #70 |
Actually we should translate SDL_bool by TSDL_Bool. This will generate compiler errors in situations as shown below:
(from sdl2.pas)
How should we handle or fix this?
The text was updated successfully, but these errors were encountered: