Hi,
I just wonder if anyone is using C++ Lambdas and Ozone ?
I tried, but Ozone stopped with the message : "An unexpected exception occurred and Ozone needs to close."... when starting up the project.
I had no problem compiling it using C++14/GCC++ 8.2.1, and it runs fine on the target platform Cortex-M4 Kinetis K27F (downloaded by J-Flash).
Sample code like this :
#define LAMBDA // Ozone v2.70 crashes with LAMBDA defined!
#ifndef LAMBDA
// use a function instead of lambda
static auto outOfRange(float value, float loMin, float hiMax)
{
return (value < loMin || value > hiMax);
};
#endif
void Measurement::sample()
{
#ifdef LAMBDA
// lambda function
auto outOfRange = [] (auto value, auto loMin, auto hiMax) { return (value < loMin || value > hiMax);};
#endif
const auto chargeOutOfRange = outOfRange(getChargeCurrent(), maxChargeCurrentLimit() - chargeCurrentToleranseLimit(), maxChargeCurrentLimit() + chargeCurrentToleranseLimit());
const auto dischargeOutOrRange = outOfRange(getDischargeCurrent(),minDischargeCurrentLimit(), maxDischargeCurrentLimit());
....
}
Regards,
Eldar
I just wonder if anyone is using C++ Lambdas and Ozone ?
I tried, but Ozone stopped with the message : "An unexpected exception occurred and Ozone needs to close."... when starting up the project.
I had no problem compiling it using C++14/GCC++ 8.2.1, and it runs fine on the target platform Cortex-M4 Kinetis K27F (downloaded by J-Flash).
Sample code like this :
#define LAMBDA // Ozone v2.70 crashes with LAMBDA defined!
#ifndef LAMBDA
// use a function instead of lambda
static auto outOfRange(float value, float loMin, float hiMax)
{
return (value < loMin || value > hiMax);
};
#endif
void Measurement::sample()
{
#ifdef LAMBDA
// lambda function
auto outOfRange = [] (auto value, auto loMin, auto hiMax) { return (value < loMin || value > hiMax);};
#endif
const auto chargeOutOfRange = outOfRange(getChargeCurrent(), maxChargeCurrentLimit() - chargeCurrentToleranseLimit(), maxChargeCurrentLimit() + chargeCurrentToleranseLimit());
const auto dischargeOutOrRange = outOfRange(getDischargeCurrent(),minDischargeCurrentLimit(), maxDischargeCurrentLimit());
....
}
Regards,
Eldar