These are chat archives for SmingHub/Sming

21st
Apr 2018
ololoshka2871
@ololoshka2871
Apr 21 2018 09:47

Good day!
Excuse me for your English, I hope for your understanding.
I'm developing a project for my small company and more or less happy with Sming. However, my version is very outdated and yesterday I decided to install the latest version from origin/develop.
I ran into some difficulties, but they were small and only improved my code, but there was also a major problem:

The following macros are declared in the new version:
SmingCore/SmingCore.h

#define min(A, B) std::min(A, B)
#define max(A, B) std::max(A, B)

and Wiring/WConstants.h

#ifndef min
#define min(a,b)                       ((a)<(b)?(a):(b))
#endif
#ifndef max
#define max(a,b)                       ((a)>(b)?(a):(b))
#endif

They cause conflict with the std::min() and std::max() templates.
For a start, I decided to try to disable them (by commenting out) and the build was successful!
Next, in order to cancel the corrections in the Sming I had to play with the #include order and add

#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif

After some includes In hard situations.

In general, are these macros useful somewhere? You may want to get discard them at all?