Pointer size for MinGW 64Bit / Castings#867
Pointer size for MinGW 64Bit / Castings#867Tropby wants to merge 2 commits intovurtun:masterfrom Tropby:master
Conversation
… 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))
dumblob
left a comment
There was a problem hiding this comment.
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) ); |
There was a problem hiding this comment.
Is this required? It's less efficient and slightly "cumbersome" compared to the previous version.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
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.