user31167: I am writing a timer function that uses the micros() function which generates a unsigned long value.  To compensate for a roll over condition, I would like to use the maximum value for that variable type.  I have a number, 4,294,967,295, but was expecting that to be a constant somewhere.  
Is there a MAX_UNSIGNED_LONG constant in the Arduino compiler files somewhere?  
I have tried that name and know it probably isn't that.  Still poking around.

user43054: Did you try to do this?:
unsigned long maxUnsignedLong = 0UL - 1UL;

or:
const unsigned long ULONG_MAX = 0UL - 1UL;


user10794: You don't need "to compensate for a roll over condition".
See my answer: https://arduino.stackexchange.com/a/33577/10794


in an Arduino compiler?

The "Arduino" compiler is a C++ compiler. That is the starting point for most questions. If you Google for:
maximum unsigned long in c++

You will find the first link leads to:
http://www.cplusplus.com/reference/climits/
In that it says:
ULONG_MAX   Maximum value for an object of type unsigned long int


user3917: Various limits.h files in the avr-gcc hierarchy define ULONG_MAX, which may be the value you want.  For example, on my system such files have paths ending with hardware/tools/avr/lib/gcc/avr/4.8.1/include-fixed/limits.h or with hardware/tools/avr/lib/gcc/avr/4.8.1/install-tools/include/limits.h and contain definitions like the following.
/* Maximum value an `unsigned long int' can hold.  (Minimum is 0).  */
#undef ULONG_MAX
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)

Note, LONG_MAX also is defined in limits.h.
Note, arithmetic done in a form like
timeDelta = micros() - prevTime;

will be correct (regardless of whether micros() overflowed) for elapsed times up to 2³² microseconds, or about 4295 seconds.

31167: <p>I am writing a timer function that uses the micros() function which generates a unsigned long value.  To compensate for a roll over condition, I would like to use the maximum value for that variable type.  I have a number, 4,294,967,295, but was expecting that to be a constant somewhere.  </p>

<p>Is there a MAX_UNSIGNED_LONG constant in the Arduino compiler files somewhere?  </p>

<p>I have tried that name and know it probably isn't that.  Still poking around.</p>
 43054: <p>Did you try to do this?:</p>

<pre><code>unsigned long maxUnsignedLong = 0UL - 1UL;
</code></pre>

<p>or:</p>

<pre><code>const unsigned long ULONG_MAX = 0UL - 1UL;
</code></pre>
 10794: <p>You don't need "to compensate for a roll over condition".</p>

<p>See my answer: <a href="https://arduino.stackexchange.com/a/33577/10794">https://arduino.stackexchange.com/a/33577/10794</a></p>

<hr>

<blockquote>
  <p>in an Arduino compiler?</p>
</blockquote>

<p>The "Arduino" compiler is a C++ compiler. That is the starting point for most questions. If you Google for:</p>

<pre><code>maximum unsigned long in c++
</code></pre>

<p>You will find the first link leads to:</p>

<p><a href="http://www.cplusplus.com/reference/climits/" rel="nofollow noreferrer">http://www.cplusplus.com/reference/climits/</a></p>

<p>In that it says:</p>

<pre><code>ULONG_MAX   Maximum value for an object of type unsigned long int
</code></pre>
 3917: <p>Various <code>limits.h</code> files in the <code>avr-gcc</code> hierarchy define <code>ULONG_MAX</code>, which may be the value you want.  For example, on my system such files have paths ending with <code>hardware/tools/avr/lib/gcc/avr/4.8.1/include-fixed/limits.h</code> or with <code>hardware/tools/avr/lib/gcc/avr/4.8.1/install-tools/include/limits.h</code> and contain definitions like the following.</p>

<pre><code>/* Maximum value an `unsigned long int' can hold.  (Minimum is 0).  */
#undef ULONG_MAX
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
</code></pre>

<p>Note, <code>LONG_MAX</code> also is defined in <code>limits.h</code>.</p>

<p>Note, arithmetic done in a form like</p>

<pre><code>timeDelta = micros() - prevTime;
</code></pre>

<p>will be correct (regardless of whether <code>micros()</code> overflowed) for elapsed times up to 2³² microseconds, or about 4295 seconds.</p>
