Desktop - 'CPP_DOUBLE_PRECISION_FLOATS' (V78B)

Monkey Forums/Monkey Bug Reports/Desktop - 'CPP_DOUBLE_PRECISION_FLOATS' (V78B)

ImmutableOctet(SKNG)(Posted 2014) [#1]
This is less of a bug, and more of a weird occurrence, but it might interest you, Mark.

I was recently working on a project, and I decided to make a 'preprocessor' module which contained several sub-modules filled with nothing but preprocessor settings, and a "defaults" system which allowed me to configure multiple targets with one interface.

At any rate, the interesting part of the story lies with the behavior of 'CPP_DOUBLE_PRECISION_FLOATS' on the 'Desktop/GLFW' target. For some reason, if this is enabled (Set to 'True') specifically on that target, the 'MouseX' and 'MouseY' functions (And their 'Touch' counterparts) don't work at all, they simply return zero every time they're called. I had to go through every single module of my code before realizing that it was 'CPP_DOUBLE_PRECISION_FLOATS'.

Of course, defining it while compiling with 'Desktop/GLFW' was probably my fault in the first place, but it strikes me as odd that it completely disables the mouse-position commands.

Just as a side note; is there a reason the main/build-file module is compiled first? (More specifically, before the preprocessor is done with other modules) This may not be the case, but it sure seemed like it. Reflection was broken, and variables I had made/defined with the preprocessor (In other modules) weren't working at all. My work-around was to simply make another module with a 'Begin' command, which was wrapped by 'Main', which works, but this just strikes me as odd.


marksibly(Posted 2014) [#2]
Ok,double precision floats issue fixed in next release.

As for the preprocessor, each module is preprocessed immediately before it is compiled. Originally, the plan was for Monkey to not have any #define like behavior (ie: for #defines to ONLY occur in CONFIG.TXT style files), for the very reason you've encountered - it can lead to 'order of import' dependency problems etc. However, the feature sort of worked it's way in, and now we've also got += to make things even dicier!