This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help restricting args of an intrinsic function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]