[aspectc-user] More demonstrations for applications of AspectC++?
Markus Elfring
Markus.Elfring at web.de
Tue Nov 29 13:41:19 CET 2011
> pointcut void_function() = "void ...::%(...)";
> advice execution("% MyClasss::%(...)" && !void_function()) : ...
>
> We have used this in an example in which we transformed C-style error codes
> into exceptions.
I would be interested in further fine-tuning for such an advice because of the
desired completion of error detection and exception handling. But I would like
to point out that a few use cases which will also need further considerations.
1. Functions with an interface style like strcpy() forward an input parameter as
their output.
2. There are a few functions where the meaning of a successful execution depends
completely on the passed input parameters.
Example: DispatchMessage();
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644934.aspx
3. An API documentation might be unclear if an error predicate should be checked.
4. An output parameter should be checked instead of a value from the function
return type (because it might be "void").
Do you recommend any other reaction than to call "exit(errno)" or "abort()" in
an environment for the programming language "C"?
How do you decide if an exception can really be thrown at the affected place in
the source code?
Would you like to add such error reporting to a reusable aspect library?
Regards,
Markus
More information about the aspectc-user
mailing list