Cross-Platform Casting std::atomic<float> to juce::var

The first snippet below is valid on Windows but not on Mac, on JUCE 7.0.8
The second snippet is valid on both systems.

My hunch is that this is a consequence of the fact that policies of implicit casting are different on Mac and Windows. Am I wrong?

    juce::var getParamValue (juce::String paramName)
    {
        return *state.getRawParameterValue (paramName);
    }
  juce::var getParamValue (juce::String paramName)
    {
        auto paramValue = state.getRawParameterValue (paramName);
        if (paramValue != nullptr)
        {
            float value = paramValue->load ();
            return juce::var (value);
        }
        return juce::var ();
    }

Different compilers on both systems, thus different C++ standards being applied.

Check the --std= flag of your compiler on both setups and make note of the different C++ language features you’ve got available (or, work to make sure you’re always using '-std=c++20' everywhere its needed …)

1 Like

Thanks!