On Thu, Nov 04, 2010 at 17:26 +0100, Julia Lawall wrote:
> On Thu, 4 Nov 2010, Vasiliy Kulikov wrote:
> 
> > On Thu, Nov 04, 2010 at 17:06 +0100, Julia Lawall wrote:
> > > On Thu, 4 Nov 2010, Vasiliy Kulikov wrote:
> > > > Obviously 1+1 is constant :)
> > > 
> > > I think this is something that has gone back and forth.  Is it a big 
> > > problem in practice?
> > 
> > Actually, I want to inspect all C99 array usages as they might be
> > dangerous if array size is not correctly checked.  If 1+1 is not
> > constant, I would get just more code to manually check.  It's not
> > horrible, but I'd want to avoid it ;)
> > 
> > Do you mean that to implement it properly you have to change too many
> > boring cases of arithmetic operators?  If so, don't trouble yourself.
> 
> No, I don't think it is hard to implement.  I think that at some point I 
> didn't want that to be a constant, only "atomic constants".  And then with 
> constant matching any expression that only involves constants, it
> was hard to specify a pattern for atomic constants.
> 
> I guess I could have an atomic constant metavariable declaration?  Or 
> maybe constexpression (like idexpression) for something that can also 
> match a more complex expression involving only constants?

If I write this - 

@@
int x;
@@

I get metavariable x, then if I write the same with const - 

@@
const x;
@@

then I should get exactly const metavariable, without any new keywords.
This is more consistent IMHO.


-- 
Vasiliy
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to