These are chat archives for SmingHub/Sming

Apr 2018
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:

#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))
#ifndef max
#define max(a,b)                       ((a)>(b)?(a):(b))

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
#ifdef max
#undef max

After some includes In hard situations.

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