user51903: I'm new to Arduino and C.
This behavior is not what I'd expect:
Serial.begin(9600);
while ( ! Serial );

int myCount = 0;

for (int i=0; i<10; i++) {
    myCount = min( ++myCount, 8 );
    Serial.print( myCount );
    Serial.print( "  " );
}

I would expect: 
1  2  3  4  5  6  7  8  8  8

But I get: 
2  4  6  8  8  8  8  8  8  8

Why is my code counting by 2?

user6936: Jaromanda X is indeed correct - min() is defined on line 92 of Arduino.h, thusly:
#define min(a,b) ((a)<(b)?(a):(b))

Therefore when the ++mycount is substituted for the a, it is in fact substituted twice, in both the (a)<(b) and the (a):(b), leading to the increment by 2, each time min(++mycount,8) is executed.
As VE7JRO mentions, as it is defined in this way, the reference for min(x,y) states:

Warning
Because of the way the min() function is implemented, avoid using
  other functions inside the brackets, it may lead to incorrect results
min(a++, 100);   // avoid this - yields incorrect results

min(a, 100);
a++;            // use this instead - keep other math outside the function


As the second example states, keep any incrementing outside of the min() macro.
Alternatively, I think that you could use the inline function to workaround this issue:
#undef min
inline int min(int a,int b) {return ((a)<(b)?(a):(b)); }

Because inline provides a real function call (with parameters) it avoids the use of macros and substitution, which gives rise to the issue that you encountered.
inline is a much better (safer) way to implement the functionality provided by macros, in many cases. For more information, see Inline functions in C++ or read a C++ reference.

51903: <p>I'm new to Arduino and C.
This behavior is not what I'd expect:</p>

<pre><code>Serial.begin(9600);
while ( ! Serial );

int myCount = 0;

for (int i=0; i&lt;10; i++) {
    myCount = min( ++myCount, 8 );
    Serial.print( myCount );
    Serial.print( "  " );
}
</code></pre>

<p>I would expect: </p>

<pre><code>1  2  3  4  5  6  7  8  8  8
</code></pre>

<p>But I get: </p>

<pre><code>2  4  6  8  8  8  8  8  8  8
</code></pre>

<p>Why is my code counting by 2?</p>
 6936: <p>Jaromanda X is indeed correct - <code>min()</code> is defined on line 92 of <a href="https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/Arduino.h" rel="nofollow noreferrer">Arduino.h</a>, thusly:</p>

<pre><code>#define min(a,b) ((a)&lt;(b)?(a):(b))
</code></pre>

<p>Therefore when the <code>++mycount</code> is substituted for the <code>a</code>, it is in fact substituted <em>twice</em>, in both the <code>(a)&lt;(b)</code> <em>and</em> the <code>(a):(b)</code>, leading to the increment by 2, each time <code>min(++mycount,8)</code> is executed.</p>

<p>As VE7JRO mentions, as it is defined in this way, the <a href="https://www.arduino.cc/en/Reference.Min" rel="nofollow noreferrer">reference for <code>min(x,y)</code></a> states:</p>

<blockquote>
  <p><strong>Warning</strong></p>
  
  <p>Because of the way the min() function is implemented, avoid using
  other functions inside the brackets, it may lead to incorrect results</p>

<pre><code>min(a++, 100);   // avoid this - yields incorrect results

min(a, 100);
a++;            // use this instead - keep other math outside the function
</code></pre>
</blockquote>

<p>As the second example states, keep <em>any</em> incrementing <em>outside</em> of the <code>min()</code> macro.</p>

<p>Alternatively, I think that you could use the <code>inline</code> function to workaround this issue:</p>

<pre><code>#undef min
inline int min(int a,int b) {return ((a)&lt;(b)?(a):(b)); }
</code></pre>

<p>Because <code>inline</code> provides a <em>real</em> function call (with parameters) it avoids the use of macros and substitution, which gives rise to the issue that you encountered.</p>

<p><code>inline</code> is a much better (safer) way to implement the functionality provided by macros, in many cases. For more information, see <a href="https://www.geeksforgeeks.org/inline-functions-cpp/" rel="nofollow noreferrer">Inline functions in C++</a> or read a C++ reference.</p>
