class Main {
static function main() {
var sortThing:Array<Null<Int>> = [0, 0, 1000, null, 800, 801, 802, 850, 850, 900, 1000, 1001, 10000, 10000, 10000];
sortThing.sort((a, b) -> {
if (a == null || b == null) return 0;
return Reflect.compare(a, b);
});
trace(sortThing);
}
}
I've noticed this behaved differently between the compilers.
On MSVC, sorting results in [0,0,1000,null,800,801,802,850,850,900,1000,1001,10000,10000,10000], but on GCC the same array instead becomes [0,0,850,1000,null,800,801,802,850,900,1000,1001,10000,10000,10000].
It's a minimal recreation of how objects in a game's scene are ordered, which also caused a bug.
While it uncovers a flaw with how the game's sorting objects, I considered that the discrepancy in how the sorting behaved between compilers could be a bug.
I've noticed this behaved differently between the compilers.
On MSVC, sorting results in
[0,0,1000,null,800,801,802,850,850,900,1000,1001,10000,10000,10000], but on GCC the same array instead becomes[0,0,850,1000,null,800,801,802,850,900,1000,1001,10000,10000,10000].It's a minimal recreation of how objects in a game's scene are ordered, which also caused a bug.
While it uncovers a flaw with how the game's sorting objects, I considered that the discrepancy in how the sorting behaved between compilers could be a bug.