bug-gnulib
[Top][All Lists]
Advanced

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

Re: GCC and __builtin_object_size


From: Bruno Haible
Subject: Re: GCC and __builtin_object_size
Date: Mon, 25 Oct 2010 11:34:53 +0200
User-agent: KMail/1.9.9

Paul Eggert wrote:
> +/* Buffer too small: would like warning at compile time, but cannot
> +   easily do it due to GCC's mishandling of __builtin_object_size.  */

I would reformulate this comment. The problem that you have with
__builtin_object_size is that it cannot be part of a constant expression. But
that is not a "mishandling" IMO: the building bricks of constant expressions
are defined in ISO C. I see no compelling reason why GCC should extend its
notion of constant expressions.

One thing is troubling me, however: That __builtin_object_size can not return
a really non-constant expression. In this case

  char buf[n < 0 ? 21 : 20];
  return strdup (inttostr (n, &buf[0]));

it returns (size_t)-1, that is, it gives up.

Bruno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]