[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_LANG_BOOL_COMPILE_TRY(C) fails with OS vendor compilers
From: |
Olaf Weber |
Subject: |
Re: AC_LANG_BOOL_COMPILE_TRY(C) fails with OS vendor compilers |
Date: |
Fri, 02 Jul 2004 16:59:55 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) |
Paul Eggert writes:
> Noah Misch <address@hidden> 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.)