Closed hhromic closed 5 years ago
@hhromic Ah, good catch!
I took this from my colour correction stuff in the gambatte core - which of course is C++, so the values really were constant, and there were no errors. I just didn't notice the issue here (should have tested the debug build!)
Thanks for fixing this. The new defines are absolutely fine,
No problem, happy to help! I was casually making a debug build to sort out a crash I'm getting with this core and stumbled upon this error.
Thanks to you too for the nice color correction implementation, games look much better indeed!
After the recent color correction addition in PR #150 (cc @jdgleaver), when building in debug mode, i.e.
make DEBUG=1
, the build fails with the following error:According to this answer, the problem is that "Const-qualified objects (of any type) are not constants in C language terminology. They cannot be used in initializers of objects with static storage duration, regardless of their type.".
The solution as the same answer points out is to simply use
#define
s as done in this PR. I hope you are okay with my chosen names for these defines.Note: his error only shows on debug builds because the compiler is configured to not perform any optimisation with
-O0
and the error is not silent anymore.