Int64_t vs juce::int64

JUCE has provided many cross-platform C++ utilities, among them juce::int64, but nowadays it seems that C++ has had a standard int64_t for a while now.

Mostly the two are interchangeable, but it seems that in Linux Makefile based builds, juce::int64 is typedef to long long, while int64_t is typedef to long. Both are 64-bit but when one overrides JUCE methods one has to use the juce::int64 specifically.

The problem is that if one usually develops in Xcode and Visual Studio and has a preference towards standard types like int64_t, then their code won’t compile on Linux, and it’s just another extra hurdle to deal with among all the other computing paper cuts :confused:

Suggestions:

  • Make juce::int64 a typedef to int64_t
  • Recommend using int64_t
  • Deprecate juce::int64

Cheers, Yair

12 Likes

If we are going this route then I think it makes sense to replace all of JUCE’s int types. This would be a very large commit and a significant breaking change.

We’ll need to evaluate how painful this will be for large JUCE-based projects. In any case, this is not something we will do before we have merged the accessibility work in JUCE 6.1.

2 Likes

a significant breaking change

At least regarding making juce::int64 a typedef to int64_t, I wouldn’t expect that to break anything

That has the potential to break user code; on Linux when juce::int64 == int64_t == long it can make previously unambiguous function overloads collide.

3 Likes

Blimey, I guess it could