Re: AC_LANG_BOOL_COMPILE_TRY(C) fails with OS vendor compilers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Eggert writes:
> Noah Misch <noah@xxxxxxxxxxxxxx> writes:

>> That said, I'd like to fix it.  Would one of the following be
>> appropriate?
>> 
>> 1) Change the test such that it creates truly invalid C in the
>>    false case.  I don't know how to do this, but perhaps a reader
>>    does.  Ideas?

> Unfortunately there's no such thing as "truly invalid C", in the sense
> that every possible C compiler, whether conforming or not, will exit
> with nonzero status when asked to compile it.  This is because people
> are free to add extensions.  The best we can do is to write code that
> fails on all practical implementations.

Perhaps I'm missing the obvious, but why wouldn't something like this
work?

        int array[!!(x)*2-1];

The !! forces (constant) expression 'x' into the range 0-1, and then
we get either 'int array[-1];' or 'int array[1];' as the final result.

-- 
Olaf Weber

               (This space left blank for technical reasons.)



_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux