SystemStats::isOperatingSystem64Bit() - which question is it meant to answer?

The documentation states:

/** Returns true if the OS is 64-bit, or false for a 32-bit OS. */
static bool isOperatingSystem64Bit();

Unfortunately it’s wildly inaccurate since none of the implementations agree with it, or with each other:

  • juce_SystemStats_mac.mm
    • JUCE_IOS ? false : true
  • juce_SystemStats_windows.cpp
    • JUCE_64BIT, else IsWow64Process()
  • juce_SystemStats_linux.cpp
    • JUCE_64BIT
  • juce_SystemStats_android.cpp
    • JUCE_64BIT

Which one is this function for?

  1. The build - what was the binary compiled for? (JUCE_64BIT already answers this, so the function would be redundant)
  2. The process - what is it running as right now? (differs from 1 only under Rosetta / Prism)
  3. The OS - is the kernel 64-bit? (basically what the comment says)
  4. The hardware - can the chip run 64-bit at all? (differs from 3 on embedded and set-top boxes)

Pick a number and I’ll do the work: implementation and testing, then open a PR. Note that “It’s 1 and the comment is wrong” is a completely fine answer - I’d just rather not guess.

Two of the current answers look wrong if the intent is 3:

  • iOS returns false, though every device since the 5s is 64-bit
    • and iOS 11 dropped 32-bit apps entirely.
  • IsWow64Process is documented to return FALSE “if the process is a 32-bit application running under 64-bit Windows 10 on ARM”
    • Microsoft’s own advice on that page being to use IsWow64Process2 instead.