This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Help restricting args of an intrinsic function
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: Joe Buck <Joe dot Buck at synopsys dot COM>, Diego Novillo <dnovillo at redhat dot com>,Syd Polk <spolk at apple dot com>, GCC List <gcc at gcc dot gnu dot org>
- Date: Mon, 2 Feb 2004 19:35:50 -0500
- Subject: Re: Help restricting args of an intrinsic function
- References: <20040202154505.A8355@synopsys.com> <4DCDEE53-55E0-11D8-A1BE-003065A77310@apple.com>
On Mon, Feb 02, 2004 at 04:31:27PM -0800, Mike Stump wrote:
> On Monday, February 2, 2004, at 03:45 PM, Joe Buck wrote:
> >So issue a warning, and make the warning suppressible. If you don't,
> >you'll then be in the position of telling people to use #define instead
> >of const,
>
> ? I don't see that that follows. Syd intends on making const int i =
> 5 work. If he does that, then there is not need to tell people to use
> #define instead of const int i = 5.
>
> >and you'll saddle us with a huge stream of additional bugs
> >(any time the compiler changes in such a way that an expression that
> >used to be simplified to a constant at -O0 isn't, we get a bug report).
>
> Again, I don't see that this follows:
>
> const int ci = 5;
> class A {
> public:
> static const int sci = 5;
> static char a1[sci];
> } a;
>
> char A::a1[sci];
>
> int a1[ci];
> int a2[A::sci];
>
> is valid code that already must work, and work is defined to be knowing
> that size of the arrays at compile time.
>
> Syd needs nothing more. Since this is already implemented, already
> works, and already is maintained, I don't see this as a maintenance
> burden. The only issue is how best to hook into it.
If you read Richard's reply, he says that will already work - in C++. In C,
const int ci = 5;
int a1[ci];
will not compile, because ci is not an integral constant-expression.
If Syd is trying to make that work in C/ObjC, as opposed to C++, some
serious surgery may be involved.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer