Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Pointer size for MinGW 64Bit / Castings #867

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Pointer size for MinGW 64Bit / Castings #867

wants to merge 2 commits into from

Conversation

Tropby
Copy link

@Tropby Tropby commented Jun 20, 2019

The pointer size of the MinGW 64Bit pointer is "unsinged long long".
Is this also true for GCC 64Bit on Linux?

There are a lot of compiler warnings at compile time for the "nuklear_gdi.h".
I have added some castings.
For the GNUC compiler I added the pragmas to suppress warnings from newer C++ standards.

Tropby added 2 commits June 20, 2019 22:01
… long" its the MinGW 64bit version used by the QT Framework.
added ignor warnings for C++11 compiler (e.g. zero-as-null-pointer-constant (NULL != nullptr))
Copy link
Contributor

@dumblob dumblob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good to me, thanks. Just the one nitpick, but I'll leave it up to you to decide and afterwards I'll merge the pull 😉.


INT row = ((width * 3 + 3) & ~3);
BITMAPINFO bi = { 0 };
BITMAPINFO bi;
memset( &bi, 0, sizeof(bi) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? It's less efficient and slightly "cumbersome" compared to the previous version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not required.
The compiler got warnings because "0" is not equal "unsinged long".
If you changed the "0" to "0ul" the compiler said "0ul" is not equal to "int".
I think the notation "{ 0 }" is not really designed for structs with different data types?

If you thinks its better to reverse this. Just do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, that's really weird. According to C99 and newer, the notation { 0 } denotes the minimal case for partial struct assignment which in this case means assign 0 to the first struct member and all following struct members disregarding their type (which might be potentially harmful as e.g. NULL can be something else than 0 on some platforms or some IEEE 754 implementations could behave incorrectly if some flags are zero, but programmers for such platforms would know what to do with this source 😉).

Are you using the provided build.bat script? Or some other compiler? What are all the options?

I would like to find out what's the issue in this case as it sounds really suspicious (might be also an issue with Microsoft Visual Studio compiler as used in build.bat).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants