On Sat, 22 Jan 2011, Håkon Løvdal wrote:
> On 21 January 2011 23:38, Philipp Kutin <[email protected]> wrote:
> > Hi,
> >
> > I'm trying to do my first steps with Coccinelle but can't get the following
> > to work: basically, for debugging, I want to implement a poor man's array
> > bound check by doing something like
> >
> > @@
> > expression E;
> > @@
> >
> > - sprite[E]
> > + sprite[{( int tmp=E; (tmp<0 ? (*(int*)123=234) : tmp) )}]
>
> Could you not wrap that construct inside a pre-processor macro? I.e.
>
> - sprite[E]
> + sprite[ARRAY_BOUND_CHECK(E)]
>
> As a bonus, I think that also would improve readability.
Indeed, that looks like a much better solution. I will add , anyway. It
will be treated just like any other binary operator, ie no notion of
ordering between the arguments.
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)