Thanks, Paul and Tom, for the details.
Akim
tom> Paul says the current C standard doesn't allow [the struct hack],
Paul> No, actually I said the _current_ C standard _does_ allow it--at least
Paul> using the [0] notation; the current standard is C99 :). It's the
Paul> _previous_ standard, C89, that doesn't :)
Thanks. I keep forgetting t
%% Tom Tromey <[EMAIL PROTECTED]> writes:
tom> Paul says the current C standard doesn't allow [the struct hack],
No, actually I said the _current_ C standard _does_ allow it--at least
using the [0] notation; the current standard is C99 :). It's the
_previous_ standard, C89, that doesn't :)
J
Olly> I'm unsure how `int a[0];' will be handled by various compilers.
Tom> gcc accepts this as an extension. It is useful when using the
Tom> "struct hack", at least.
Akim> I don't understand what you are referring to. Could you give details?
In C you can write something like this:
struct
> "Tom" == Tom Tromey <[EMAIL PROTECTED]> writes:
Olly> I'm unsure how `int a[0];' will be handled by various compilers.
Tom> gcc accepts this as an extension. It is useful when using the
Tom> "struct hack", at least.
I don't understand what you are referring to. Could you give details?
On Feb 19, 2000, Olly Betts <[EMAIL PROTECTED]> wrote:
> This defect is easy enough to correct by making use of your idea of a
> potentially negative array dimension - we can try compiling "int
> a[(char)-1];" which will compile if char is unsigned, and fail if it's
> signed. Revised patch attac
%% Olly Betts <[EMAIL PROTECTED]> writes:
>> gcc accepts this as an extension.
>> It is useful when using the "struct hack", at least.
ob> Ah yes, of course. Not a great justification though, since an
ob> array size of one gives a much more portable struct hack (albeit
ob> slightly ug
In message <[EMAIL PROTECTED]>, Tom Tromey writes:
>Olly> Dear me. Actually, BCPL's truth value is -1, so I can believe early
>Olly> versions of C might behave the same way.
>
>It seems unlikely that this is important.
I tend to agree, but there's an equally tidy solution which avoids the
issue.
Olly> Dear me. Actually, BCPL's truth value is -1, so I can believe early
Olly> versions of C might behave the same way.
It seems unlikely that this is important.
Olly> I'm unsure how `int a[0];' will be handled by various compilers.
gcc accepts this as an extension.
It is useful when using th
In message <[EMAIL PROTECTED]>, Earnie Boyd writes:
>--- Steve Robbins <[EMAIL PROTECTED]> wrote:
>> Has it always been the case that `0<5' is `1'?
>
>I think I remember cases (VAX?) of 0<5 produces -1.
Dear me. Actually, BCPL's truth value is -1, so I can believe early
versions of C might behav
> "Steve" == Steve Robbins <[EMAIL PROTECTED]> writes:
Steve> Has it always been the case that `0<5' is `1'?
Yes.
Tom
--- Steve Robbins <[EMAIL PROTECTED]> wrote:
-8<-
> Wow, that's pretty clever! But since any nonzero value is considered
> "true" by C, I worry whether a comparison is guaranteed to return `1' if
> true. To my surprise, my second edition K+R claims that this is so for
> ANSI C. Has it always be
On Sat, 19 Feb 2000, Olly Betts wrote:
> @@ -2420,16 +2411,13 @@
> [if test "$GCC" = yes; then
>ac_cv_c_long_double=yes
> else
> -AC_TRY_RUN(
> -[int
> -main()
> -{
> - /* The Stardent Vistra knows sizeof(long double), but does not
> +AC_TRY_COMPILE(,
> +[/* The Stardent Vistra knows sizeo
In message <[EMAIL PROTECTED]>, Tom Tromey writes:
>Your patch has a problem if sizeof(int)==sizeof(char).
Oops, missed that one. Another case we'll rarely if ever meet, but
permitted by ANSI.
This defect is easy enough to correct by making use of your idea of a
potentially negative array dimen
> "Olly" == Olly Betts <[EMAIL PROTECTED]> writes:
Olly> Only one potential down side I can see - is it known that this
Olly> trick works as expected everywhere?
I don't think we've tried it anywhere, but I imagine it is pretty
safe. There's another trick along similar lines: you can try to
Hi folks,
I noticed that it's possible to change AC_C_CHAR_UNSIGNED and
AC_C_LONG_DOUBLE to use AC_TRY_COMPILE rather than AC_TRY_RUN by using
the "switch with duplicate case labels" trick.
Benefits:
* Works equally well when cross-compiling
* Faster - no linking, and no test program to run
On
16 matches
Mail list logo