Hello,

The programming languages ā€œCā€ and ā€œC++ā€ support functionality where characters
can be ambiguous:
The asterisk can be used for the specification of multiplications
or pointer dereferences (for example).
https://softwareengineering.stackexchange.com/questions/124570/why-pointer-symbol-and-multiplication-sign-are-same-in-c-c

Now I would like to specify a source code search for the case that
unary operations would be used within computations.
The Coccinelle software accepts the following approach.

@assignment@
expression x, y;
@@
* y = ... *(x) ...;


I became curious if another small script for the semantic patch languages
should also work then.

@check@
expression x, y;
statement es;
@@
*if ( \( !(x) \| x == NULL \) )
*   y = ... *(x) ...;
 else
    es


But a parse error is reported so far for this code variant.
How will the software situation evolve further around such challenges?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to