On Thu, Dec 9, 2010 at 20:13, Paul Eggert <[email protected]> wrote:
> On 12/07/10 20:41, Mike Gibson wrote:
>> Does a test already exist that checks for if the >> operator in C does
>> arithmetic shift?
>
> Doesn't this suffice, without dragging Autoconf into it?
>
> #if -1 >> 1 == -1
No. It won't work. Your preprocessor directive checks behavior of
the preprocessor (/bin/cpp for example) that may have nothing with the
behavior of the compiler and behavior of the code generated by
compiler.
In another words:
#if -1 >> 1 == -1
check preprocessor only
int i = -1 >> 1; if (i == -1) {}
may be evaluated at the compile time and therefore may check the
compiler itselt, not the code generated by compiler (which also
important).
volatile int i = -1; i = i >> 1; if (i == -1) {}
force bypass the optimizer, enforce check for generated code
--
Andrew W. Nosenko <[email protected]>
_______________________________________________
Autoconf mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/autoconf